# Friends

$n$ of Amin's friends gathered at his place to celebrate his birthday. They decided to gather in a row to make a toast to his health. Let's number them in this row from $1$ to $n$.

Among these friends, there are those who know each other and those who don't. Amin's friends' middle school $(a_{i})$ and university $(b_{i})$ are specified. If two people have different middle schools and different universities, they don't know each other. From a mathematical point of view, Amin's friends with number $i$ and number $j$ don't know each other if the conditions $a_{i}=a_{j}$ and $b_{i}=b_{j}$ are met.

And Amin, even though it's his birthday, still has strange thoughts and questions coming to his mind. "I wonder if there are two friends in the row from number $l$ to number $r$ (including $l$ and $r$) who don't know each other? 🤔"

Answer the questions that come to Amin's mind.

## Input

The first line contains a single integer $n(2≤n≤10_{5})$, and in each of the following $n$ lines, there are two integers $a_{i}$ and $b_{i}(1≤a_{i},b_{i}≤10_{9},1≤i≤n)$. The next line specifies the number of queries $q(1≤q≤10_{5})$ that Amin came up with. Each of the next $q$ lines specifies queries, namely two integers $l_{j}$ and $r_{j}(1≤l_{j}<r_{j}≤n)$.

## Output

For each query, output two integers on a new line: the numbers of any two of Amin's friends who don't know each other in the specified range, and output $00$ if there are no such two friends. If there are multiple correct answers, any of them can be output.

## Examples

## Scoring

This problem consists of $4$ subtasks. Points for a subtask are awarded only if all the tests associated with that subtask are passed successfully.

($20$ points): $n,q≤100$;

($30$ points): $n,q≤1000$;

($20$ points): $n,q≤5000$;

($30$ points): $noadditionalconstraints$;