we are provided with n different range(l,r) and each range have value (val) associated with it . now we have given k query , in each query we have given one integer X , and we have to tell the minimum value we can obtain form the ranges in which X lies i.e L<=x<=R , if their does not exist any range print -1 . Input : n — number of range . next n line contain — ( l , r , val ) q — number of query. next q line contain — (X) output : q — line with minimum value.
For Example: 4 0 0 2 0 2 10 5 6 13 1 1 2 6 0 1 2 3 5 8
Output: 2 2 10 -1 13 -1