Segments
시간 제한5초메모리 제한2048 MB
각 질의 x = p에 대해 모든 선분이 이 수직선과 만나도록 늘려야 하는 가로 거리 중 최댓값을 구한다.
문제
In the first quadrant of a coordinate plane, you are given line segments parallel to the -axis. Each segment () is represented by the coordinates of its left and right endpoints, and , respectively. All coordinates are positive integers.
You must now answer queries. For each query, a vertical line , parallel to the -axis, is given. The vertical line is represented by a single positive integer .
If each segment is horizontally extended, it will eventually meet the line at the point . If the segment, including its endpoints, already meets , no extension is needed. For example, suppose there are segments , , , , and , and a single line . The first segment must be extended by to the right, the second segment to the right, the third and the fourth segments , and the fifth segment to the left for each to meet .
For each query, determine the maximum among the extension lengths required for all segments to meet the line . Formally, let denote the distance that segment must be extended to intersect at . For each query, output . In the example above, the answer to the query is . See the figure below.

Given segments and queries, write a program to output the maximum extension length for each query.
입력
Your program is to read from standard input. The input starts with a line containing two integers () and (), where is the number of line segments and is the number of queries. In the following lines, the -th line contains three integers, , , and (; ), where (resp. ) is the -coordinate of left (resp. right) endpoint of and is the -coordinate of both endpoints of . In the following lines of queries, the -th line contains one integer () which denotes the vertical line .
출력
Your program is to write to standard output. Print exactly one line per each query. The -th line should contain the maximum among the extension lengths required for all segments to meet at .