You will be given a pair of positive integers (**x, y**). In one step, you take the greater of the two integers and subtract the smaller one from it. You keep doing this untill one of the integers becomes 0 and then you stop. For example: (5,13) --> (5,8) --> (5,3) --> (2,3) --> (2,1) --> (1,1) --> (1,0). This takes 6 steps in this case. You have to find out the number of steps it takes to reach a situation where one of the integers becomes 0.

**Input: **

The first line of input contains a single integer **T** denoting the number of test cases. Then **T** test cases follow. Each test case consists of one line only. The line consists one two space separated positive integers which denote (**x _{i}, y_{i}**).

**Output:**

Corresponding to each test case, in a new line, print the number of steps.

**Constraints:**

1 ≤ **T** ≤ 200

1 ≤ **x _{i}, y_{i} **≤ 10

**Example:**

**Input**

2

232 8

1 354

**Output**

29

354

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

hari32147 | 128 |

RaghavaMahanthi | 100 |

AdityaRaj9 | 84 |

AtakanSarıoğlu | 83 |

geetyadav | 82 |

abducodes | 866 |

harshtyagi36 | 432 |

arpit_anshuman | 331 |

vamsikrishna55 | 323 |

sandipbhaumik | 321 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.