Read problems statements in Mandarin chinese, Russian  and Vietnamese as well. 

Danya gave integers $a$, $b$ and $n$ to Archi. Archi wants to compare $a^{n}$ and $b^{n}$. Help Archi with this task.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains three space-separated integers $a$, $b$ and $n$.

------  Output ------
For each test case, print a single line containing one integer: $1$ if $a^{n} > b^{n}$, $2$ if $a^{n} < b^{n}$ or $0$ if $a^{n} = b^{n}$.

------  Constraints  ------
$1 ≤ T ≤ 1,000$
$|a|, |b| ≤ 10^{9}$
$1 ≤ n ≤ 10^{9}$

----- Sample Input 1 ------ 
2

3 4 5

-3 2 4
----- Sample Output 1 ------ 
2

1
----- explanation 1 ------ 
Example case 1: $a^{n} = 243$ and $b^{n} = 1024$.

Example case 2: $a^{n} = 81$ and $b^{n} = 16$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
import math
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	if n % 2 == 0:
		if abs(a) == abs(b):
			print(0)
		elif abs(a) > abs(b):
			print(1)
		else:
			print(2)
	elif a == b:
		print(0)
	elif a > b:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if n % 2 == 0:
		if abs(a) == abs(b):
			print(0)
		elif abs(a) > abs(b):
			print(1)
		else:
			print(2)
	elif a == b:
		print(0)
	elif a > b:
		print(1)
	else:
		print(2)


test = int(input())
for i in range(test):
	(g, h, n) = map(int, input().split())
	a = abs(g)
	b = abs(h)
	if n % 2 == 0:
		if a > b:
			print(1)
		elif a < b:
			print(2)
		else:
			print(0)
	elif g > h:
		print(1)
	elif g < h:
		print(2)
	else:
		print(0)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if not n % 2:
		(a, b) = (abs(a), abs(b))
	if a > b:
		print('1')
	elif a < b:
		print('2')
	else:
		print('0')


a = int(input(''))
for i in range(a):
	(a1, a2, n) = [int(x) for x in input('').split()]
	if n % 2 == 0:
		a1 = abs(a1)
		a2 = abs(a2)
	if a1 > a2:
		print(1)
	elif a1 < a2:
		print(2)
	else:
		print(0)


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	if n % 2 == 0:
		a = abs(a)
		b = abs(b)
	if a > b:
		print(1)
	elif a < b:
		print(2)
	else:
		print(0)
	t -= 1


t = int(input())
for _ in range(t):
	n = list(map(int, input().split()))
	if n[2] % 2 == 0:
		if abs(n[0]) > abs(n[1]):
			print(1)
		elif abs(n[1]) > abs(n[0]):
			print(2)
		else:
			print(0)
	elif n[0] > n[1]:
		print(1)
	elif n[1] > n[0]:
		print(2)
	else:
		print(0)


for i in range(int(input())):
	(x, y, n) = list(map(int, input().split()))
	if n % 2 == 0:
		(x, y) = (abs(x), abs(y))
	if x > y:
		print('1')
	elif x < y:
		print('2')
	else:
		print('0')


def cmp(a, b):
	if a > b:
		return 1
	if a == b:
		return 0
	if a < b:
		return 2
for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(cmp(abs(a), abs(b))) if (a < 0 or b < 0) and n % 2 == 0 else print(cmp(a, b))


n = int(input())
for i in range(n):
	(a, b, n) = map(int, input().split())
	if n % 2 == 0:
		A = abs(a)
		B = abs(b)
		if A == B:
			print('0')
		elif A > B:
			print('1')
		else:
			print('2')
	else:
		A = a
		B = b
		if A == B:
			print('0')
		elif A > B:
			print('1')
		else:
			print('2')


for t in range(int(input())):
	(x, y, n) = map(int, input().split())
	flag = True
	if n % 2 != 0:
		flag = False
	if flag == True:
		if abs(x) > abs(y):
			print(1)
		elif abs(x) < abs(y):
			print(2)
		elif abs(x) == abs(y):
			print(0)
	elif x > y:
		print(1)
	elif x < y:
		print(2)
	elif x == y:
		print(0)


T = int(input())
for i in range(T):
	(a, b, n) = map(int, input().split())
	if a == b or (a == -b and n % 2 == 0):
		print(0)
		continue
	if a >= 0:
		if b >= 0:
			if a > b:
				print(1)
			else:
				print(2)
		elif a == -b:
			print(1)
		elif a > -b:
			print(1)
		elif n % 2 == 0:
			print(2)
		else:
			print(1)
	elif b < 0:
		if a < b:
			if n % 2 == 0:
				print(1)
			else:
				print(2)
		elif n % 2 == 0:
			print(2)
		else:
			print(1)
	elif -a > b:
		if n % 2 == 0:
			print(1)
		else:
			print(2)
	else:
		print(2)


def solve(a, b, n):
	if n % 2 == 0:
		a = abs(a)
		b = abs(b)
		if a == b:
			print(0)
		elif a > b:
			print(1)
		else:
			print(2)
	elif a == b:
		print(0)
	elif a > b:
		print(1)
	else:
		print(2)

def main():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		solve(a, b, c)
main()


import math
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if n % 2 == 0:
		if a ** 2 > b ** 2:
			print('1')
		elif a ** 2 < b ** 2:
			print('2')
		elif a ** 2 == b ** 2:
			print('0')
	elif a ** 3 > b ** 3:
		print('1')
	elif a ** 3 < b ** 3:
		print('2')
	elif a ** 3 == b ** 3:
		print(+0)


import math
t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	if a == b or (n % 2 == 0 and abs(a) == abs(b)):
		print(0)
	elif n % 2 == 0:
		if abs(a) > abs(b):
			print(1)
		else:
			print(2)
	elif a > b:
		print(1)
	else:
		print(2)
	t -= 1