9088 - Line Segments   

Description

There are some line segments in 1 dimensional space. If two segments overlap or one segment’s start is another segment’s end, we consider them as one segment. Please output the length of the longest segment.

Input

There are multiple of test cases.  Each case begins with an integer N (1 <= N <= 106) which represents the number of line segments.  In the next N lines, each line contains two integers a and b (1 <= a <= b <= 109) representing a line segment.  The input is terminated by N = 0.

Output

For each test case, output the length of the longest segment.

Sample Input  Download

Sample Output  Download

Tags




Discuss