Watch the Right Hand Alternation Exercises online guitar lesson by Andrew Leonard from Beginner Method for Classical Guitar
Once you can play rest strokes with I & M, it's time to learn to "alternate" your fingers. This is an essential skill and an important part of building classical guitar technique. So, practice slowly at first so you can think ahead of your finger movements. Take your time and do as many repetitions with your thumb on each string until you feel comfortable and confident. Then move on. At about 4:35, you'll find the full exercise.
Part 1 keeps I & M alternating on the first string and the thumb (P) moving to lower strings. Part 2 keeps the thumb steady while the fingers play on descending strings. I'll take you slowly through the two different parts of the exercise.