Rearrange the following sentences to form a meaningful paragraph:
P: The teacher explained the topic.
Q: The students listened attentively.
R: They asked questions for better understanding.
S: They completed their homework based on the lesson.