cho.sh
Notes
Loading...

Rainfall

Time limit

2s

Memory limit

128 MB

Problem

For each year, the officially measured amount of rain is called that year's rainfall. Based on these records, people may say, “In year X, the rainfall was the greatest since year Y.” Some yearly records may be missing, so you must decide whether each statement is certainly true, only possible, or impossible.

The statement “In year X, the rainfall was the greatest since year Y” is true when all of the following conditions hold.

  1. The rainfall is known for every year from Y through X.
  2. The rainfall in year X is less than or equal to the rainfall in year Y.
  3. For every year Z such that Y < Z < X, the rainfall in year Z is less than the rainfall in year X.

If the missing yearly rainfall values can be chosen so that the conditions hold, the answer is maybe. If the known information already makes the conditions impossible, the answer is false. If every condition is fully verified, the answer is true.

Input

The first line contains an integer n (1 <= n <= 50,000).

Each of the next n lines contains two integers y and r, meaning that the rainfall in year y is r.

  • 0 <= |y| <= 1,000,000,000
  • 1 <= r <= 1,000,000,000

The rainfall records are given in increasing order of y.

The next line contains an integer m (1 <= m <= 10,000).

Each of the next m lines contains two integers Y and X, representing the statement “In year X, the rainfall was the greatest since year Y.”

  • -1,000,000,000 <= Y < X <= 1,000,000,000

Output

For each statement, print one answer on its own line.

  • Print true if the statement is certainly true.
  • Print maybe if it could be true but cannot be confirmed.
  • Print false if it is impossible.