You have to assume that the teacher pushes the cart so as to keep the cart a constant distance in front. She adjusts Fteacher to keep the two accelerations the same.
I must point out something misleading in the question. It says "the force of friction, which opposes the motion". The main frictional force shown is Ffloor, and that provides the motion.
The force shown as f opposing the motion includes rolling resistance, which is different from friction. What friction there is contributing to f is static friction and is a result of kinetic friction in the wheel axle; it is not kinetic friction between the wheel and the floor.
If we take the rope as massless then there can be no net force on it, and the tension is the same along its length. It is therefore equal to the forces applied by the two teams, so those are equal to each other.
Does that answer your question?