#K81457. Find an Intersection Interval
Find an Intersection Interval
Find an Intersection Interval
You are given closed intervals on the integer number line. Each interval is defined by its endpoints , where and are integers and the interval includes all integers such that . You are also given an integer . Your task is to find an integer such that lies in at least of the given intervals. If there are multiple valid answers, you may output any one of them. The answer should be presented as an interval with identical endpoints, i.e. .
For example, consider the intervals , , and with . The integer is contained in at least two intervals, so the output can be .
inputFormat
The input is read from standard input (stdin) and has the following format:
The first line contains two integers and , where is the number of intervals and is the required number of intervals that must intersect at a point. The next lines each contain two integers and , representing the endpoints of the -th interval.
outputFormat
Output a single line to standard output (stdout) containing two identical integers separated by a space, representing an interval where is an integer that lies in at least intervals.## sample
3 2
1 5
4 8
6 10
4 4
</p>