You are given closed, integer intervals and integers .
Write a program that:
- reads the number of intervals, their end points and integers from the standard input,
- computes the minimal size of a set of integers which has at least common elements with interval , for each ,
- writes the answer to the standard output.
输入格式
The first line of the input contains an integer – the number of intervals. The following lines describe the intervals. The -th line of the input contains three integers and separated by single spaces and such that and .
输出格式
The output contains exactly one integer equal to the minimal size of set sharing at least ci elements with interval , for each .