#P2471. [SCOI2007] 降雨量

[SCOI2007] 降雨量

Description

We often say statements like: "Year XX has the highest rainfall since year YY." It means that the rainfall in year XX does not exceed that in year YY, and for any year ZZ with Y<Z<XY < Z < X, the rainfall in year ZZ is strictly less than that in year XX. For example, if the rainfalls in years 2002, 2003, 2004, and 2005 are 4920, 5901, 2832, and 3890 respectively, then we can say "2005 is the highest since 2003," but we cannot say "2005 is the highest since 2002." Since the rainfalls of some years are unknown, some statements may be true or may be false.

Input Format

The first line contains a positive integer nn, the number of known records.
Each of the following nn lines contains two integers yiy_i and rir_i, the year and its rainfall, sorted in strictly increasing order of year, i.e., yi<yi+1y_i < y_{i+1}.
The next line contains a positive integer mm, the number of queries.
Each of the following mm lines contains two integers YY and XX, asking whether the statement "Year XX has the highest rainfall since year YY." is "true", "false", or "maybe".

Output Format

For each query, output true, false, or maybe.

6
2002 4920
2003 5901
2004 2832
2005 3890
2007 5609
2008 3024
5
2002 2005
2003 2005
2002 2007
2003 2007
2005 2008

false
true
false
maybe
false

Hint

Constraints: For 100% of the testdata, 1n500001 \le n \le 50000, 1m100001 \le m \le 10000, 109yi109-10^9 \le y_i \le 10^9, 1ri1091 \le r_i \le 10^9, 109X,Y109-10^9 \le X, Y \le 10^9.
It is guaranteed that Y<XY < X.

Translated by ChatGPT 5