Friends
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 to .
Among these friends, there are those who know each other and those who don't. Amin's friends' middle school and university 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 and number don't know each other if the conditions and 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 to number (including and ) who don't know each other? 🤔"
Answer the questions that come to Amin's mind.
Input
The first line contains a single integer , and in each of the following lines, there are two integers and . The next line specifies the number of queries that Amin came up with. Each of the next lines specifies queries, namely two integers and .
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 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 subtasks. Points for a subtask are awarded only if all the tests associated with that subtask are passed successfully.
( points): ;
( points): ;
( points): ;
( points): ;