Newtons law- For every action, there is a reaction
The first team to tug is the action force, causing the pull on the rope, as the reaction force, the other team's rope end feels the pull.
When two teams are pulling in opposite directions, the movement of the rope (as calculated by Newton's second law) will be determined by the net force on the rope.