ACMPRAC1 - Appetizer

Given n pairs of numbers of the form a, b find which pair has the highest a^b value. If more than one pair have the same value, print the pair which occurs first in the input.

Note: ^ indicates exponent, not XOR. Example, 2^3 = 8, 3^3 = 27

Input

Input starts with an integer T (<= 100), denoting the number of test cases.

Each case starts with a line containing an integer n (1 <= n <= 1000) which denotes the number of pairs.

Next n lines contain two numbers a, b each.

(1 <= a, b <= 1000000)

Output

For each test case, print two numbers, separated by a space, which indicates the answer for the corresponding test case.

The answer for each test case must be in a new line.

Example

Input:
4
3
1 1
2 2
3 3
5
10 5
5 5
2 3
3 3
3 10
1
7 7
2
9 9
2 2

Output:
3 3
10 5
7 7
9 9

Added by:TouristGuide
Date:2012-08-27
Time limit:1s-1.646s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2012-08-30 08:53:08 Josef Ziegler
move to tutorial
2012-08-30 05:54:06 rahul kumar singh
@why i m getting wrong my logic is correct any worst test case provide please
2012-08-30 08:52:58 DaRksTar
Tutorial...
2012-08-30 08:52:56 (Tjandra Satria Gunawan)(曾毅昆)
definitely tutorial
2012-08-29 08:21:00 Francky
Tutorial problem for sure.
Warning, the input seems badly formated, my python code got NZEC !
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.