This question already has an answer here:
25 horses, 5 race tracks; we need to choose the top 3 horses. What is the minimum number of races you need?
I have thinking deeply and figure out this: First race all 25 horses in groups of 5 to figure out the top 3 in each group (which will leave 15 horses). Call them: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 Here, A1 is faster than A2. A2 is faster than A3. The same applies for the rest of the groups. Now race A1, B1 C1 D1 E1 Lets say the order of the horses according to ranking was A1, B1,C1,D1,E1
So A1 is No 1. Now A1 is faster than B1 and B1 is faster than C1. So we can get rid of the entire D and E groups. 9 horse remain. Also, A1 is faster than B1 and B1 is faster than C1. So we can get rid of C2 and C3. Now 7 horses remain. A1 is faster than B1. B1 is faster than B2. Get rid of B3, and 6 horses remain.
Out of these, we know A1 is the fastest. So now race A2, A3, B1,B2,C1 to figure out No 2 and No 3 positions.