SP30828 CLSLDR - Class Leader

Description

This is new year in Planet X and there is something special! A classroom in this planet is looking for a new class leader using an unique game! These are the ways how the game is played. 1\. There are **n** students in the class. Each student is labeled from 1 (first student) to **n** (last student). 2\. A paper is given to **m**-th student. 3\. The next **o**-th student who gets the paper quits the game. 4\. The paper is passed until there is one last student who hasn't quitted the game. 5\. The student becomes the class leader. Now, your task is to find the number of such student.

Input Format

The first line contains a number **T** (0

Output Format

For each test cases, print the required answer.