#P431. 【例75.2】 区间合并

【例75.2】 区间合并

Description

Given nn closed intervals [aia_i, bib_i], where i=1,2,...,ni = 1, 2, ..., n.
Any two adjacent or overlapping closed intervals can be merged into one closed interval. For example, [11, 22] and [22, 33] can be merged into [11, 33], [11, 33] and [22, 44] can be merged into [11, 44], but [11, 22] and [33, 44] cannot be merged.
Our task is to determine if these intervals can be merged into a single closed interval. If possible, output this closed interval; otherwise, output "nono".

Input Format

The first line contains an integer nn, 3n500003 ≤ n ≤ 50000, representing the number of intervals. The next nn lines each contain two integers aia_i and bib_i, separated by a space, representing the interval [aia_i, bib_i] (where 1aibi100001 ≤ a_i ≤ b_i ≤ 10000).

Output Format

Output one line. If these intervals can be merged into a single closed interval, output the left and right boundaries of this closed interval, separated by a space; otherwise, output "nono".

Sample

5
5 6
1 5
10 10
6 9
8 10
1 10