Wu-Fu Street is an incredibly straight street that can be described as a one-dimensional number line, and each building’s location on the street can be represented with just one number. Xiao-Ming the TimeTraveler knows that there are n stores of k store-types that had opened, has opened, or will open on the street. The $i$-th store can be described with four integers: $x_i,$ $t_i,$ $a_i,$ $b_i,$ representing the store’s location, the store’s type, the year when it starts its business, and the year when it is closed.
Xiao-Ming the Time Traveler wants to choose a certain year and a certain location on Wu-Fu Street to live in. He has narrowed down his preference list to $q$ location-year pairs. The $i$-th pair can be described with two integers: $l_i,$ $y_i,$ representing the location and the year of the pair. Now he wants to evaluate the life quality of these pairs. He defines the inconvenience index of a location-year pair to be the inaccessibility of the most inaccessible store-type of that pair. The inaccessibility of a location-year pair to store-type $t$ is defined as the distance from the location to the nearest type-$t$ store that is open in the year. We say the $i$-th store is open in the year $y$ if $a_i ≤ y ≤ b_i.$ Note that in some years, Wu-Fu Street may not have all the $k$ store-types on it. In that case, the inconvenience index is defined as $−1$.
Your task is to help Xiao-Ming find out the inconvenience index of each location-year pair.