The input consists of several test cases and ends with a line containing a zero.
In each test case, the first line contains a integer N ( 1 ≤ N ≤ 100,000) indicating the total number of the weddings.
In the next N lines, each line contains two integers Si and Ti. (0 <= Si < Ti <= 2147483647)