#C4356. Common Availability Finder

    ID: 47885 Type: Default 1000ms 256MiB

Common Availability Finder

Common Availability Finder

You are given a set of availability intervals for invitees, represented as a list of pairs \((s_i, e_i)\) for \(i=1,2,...,n\). Your task is to determine the common availability period, i.e. the intersection of all the intervals. Formally, if the intervals are \(\{(s_i, e_i)\}_{i=1}^n\), then the common availability is given by \(S = \max_{1 \le i \le n} s_i\) and \(E = \min_{1 \le i \le n} e_i\). If \(S \le E\), then the answer is the interval \(S\) to \(E\) (note that when \(S = E\), it is considered a valid common availability). Otherwise, if \(S > E\) or if there are no intervals, output "No common availability".

The problem tests your ability to process simple interval intersections using standard input and output.

inputFormat

The first line of the input contains a single integer \(n\) representing the number of intervals. \(n\) can be zero. Each of the following \(n\) lines contains two space-separated integers \(s_i\) and \(e_i\) representing the start and end of the \(i^{th}\) interval.

outputFormat

If a common availability period exists (i.e. if \(S \le E\)), output two space-separated integers representing \(S\) and \(E\). Otherwise, output the string "No common availability".

## sample
3
900 1030
1000 1100
1000 1030
1000 1030