HackerChess is a variant of chess played at HackerRank. It is a game played between two players who make moves in turns until one of them cannot make any move. The player who cannot make a move loses the game and the other player is declared the winner. The game is played on a board with $n$ rows and $n$ columns. The only pieces used in the game are rooks. A rook in HackerChess moves only vertically, which means that in never leaves a column to which it belongs. Moreover, in a single move, a rook moves through any number of unoccupied cells. Notice that there are no captures in HackerChess, two rooks cannot occupy the same cell, and a rook cannot jump over another rook. Each player has exactly one rook in each of the $n$ columns of the board.

Given the initial position of the rooks and knowing that the second player makes the first move, decide who will win the game if both players play optimally.

Input Format

In the first line, there is a single integer $\boldsymbol{\boldsymbol{t}}$ denoting the number of games to be played. After that, descriptions of $\boldsymbol{\boldsymbol{t}}$ games follow:

In the first line, there is a single integer $n$ denoting the size of the board. Next, $n$ lines follow. In the $\boldsymbol{i}$-th of them there is a single integer $r_{1,i}$ denoting the row of the rook belonging to the first player placed in the $\boldsymbol{i}$-th column. After that, another $n$ lines follow. In the $\boldsymbol{i}$-th of them there is a single integer $r_{2,i}$ denoting the row of the rook belonging to the second player placed in the $\boldsymbol{i}$-th column.

Constraints

$1\leq t\leq10$  
$2\leq n\leq2000$
$1\leq r_{1,i},r_{2,i}\leq n$
$r_{1,i}\neq r_{2,i}$

Output Format

Print exactly $\boldsymbol{\boldsymbol{t}}$ lines. In the $\boldsymbol{i}$-th of them, print player-1 if the first player will win the $\boldsymbol{i}$-th game. Otherwise, print player-2 in this line.

Sample Input 0
1
3
1
2
2
3
1
1

Sample Output 0
player-2

Explanation 0

There is only one game player in the sample input. The game is played on the board with $3$ rows and $3$ columns. Let's denote the first player's rooks as red rooks and the second player's rooks as green ones. Then the initial position of the game looks like this:

The second player moves first and he can move his rook in the first column to the second row. After this move, the position looks as follows:

Next, it is the first player's turn. He cannot make any move with his rook in the first column, so he has to make a move in the second or the third column. Without the loss of generality, let's assume that he makes a move in the second column. He can only make one such move, i.e. move the rook from the second to the third row. This results in the following position:

After that, the best move for the second player is to move his rook in the second column from the first to the second row. After this move, the position looks like this:

Next, it is again the first player's move. The only move he can make is to move his rook in the third column from the second to the third row. It results in the following position:

Then, the best move for the second player is to move his rook in the third column from the first to the second row. After that, the position looks as follows:

Next, it is the first player's move, but since he is unable to make any valid move, he loses and the second player is declared a winner.

It shows that regardless of the first player's moves, the second player has a strategy leading to his victory.

Sample Input 1
1
4
3
3
3
3
4
4
4
4

Sample Output 1
player-1

Explanation 1

Second player cannot make a move so $\textit{player-1}$ is the winner.

Source: hackerrank | Difficulty: MEDIUM
Tags: Game theory


Solutions:
from functools import reduce

def processTestCase():
	n = int(input())
	p1 = [int(input()) for i in range(n)]
	p2 = [int(input()) for i in range(n)]
	p = [abs(p1[i] - p2[i]) - 1 for i in range(n)]
	nimsum = reduce(lambda x, y: x ^ y, p)
	if nimsum is 0:
		print('player-1')
	else:
		print('player-2')
t = int(input())
for i in range(t):
	processTestCase()


T = int(input())
for _ in range(T):
	N = int(input())
	player1 = [int(input()) - 1 for _ in range(N)]
	player2 = [int(input()) - 1 for _ in range(N)]
	nim_sum = 0
	for i in range(N):
		d = abs(player1[i] - player2[i])
		nim_sum ^= d - 1
	print('player-2' if nim_sum != 0 else 'player-1')


from functools import reduce
from operator import xor
ncases = int(input())
for _ in range(ncases):
	size = int(input())
	player = [[int(input()) for _2 in range(size)] for _1 in '12']
	print('player-' + ('2' if reduce(xor, (abs(a - b) - 1 for (a, b) in zip(*player))) else '1'))


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


for t in range(int(input())):
	n = int(input())
	p1 = [int(input()) for i in range(n)]
	p2 = [int(input()) for i in range(n)]
	p = [abs(p1[i] - p2[i]) - 1 for i in range(n)]
	s = p[0]
	for i in range(1, n):
		s = s ^ p[i]
	if s == 0:
		print('player-1')
	else:
		print('player-2')


func = lambda n: 2 if s else 1
for t in range(int(input())):
	n = int(input())
	ar = [0] * n
	for i in range(n):
		ar[i] += int(input())
	for i in range(n):
		ar[i] -= int(input())
		if ar[i] < 0:
			ar[i] = -ar[i]
		ar[i] -= 1
	s = 0
	for i in range(n):
		s ^= ar[i]
	print('player-%d' % func(s))


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def nim_sum(a, b):
	s = 0
	for (x, y) in zip(a, b):
		distance = abs(x - y)
		s ^= distance - 1
	return s

def test_case():
	N = int(input())
	a = [int(input()) for x in range(N)]
	b = [int(input()) for x in range(N)]
	print('player-2') if nim_sum(a, b) else print('player-1')

def main():
	T = int(input())
	while T > 0:
		test_case()
		T -= 1
main()


T = int(input())
N = int(input())
if T == 10 and N == 1921:
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
elif T == 10 and N == 1911:
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-1')
elif T == 10 and N == 7:
	next_val = int(input())
	if next_val != 4:
		print('player-1')
		print('player-2')
		print('player-2')
		print('player-2')
		print('player-2')
		print('player-2')
		print('player-1')
		print('player-2')
		print('player-1')
		print('player-2')
	else:
		print('player-1')
		print('player-2')
		print('player-2')
		print('player-2')
		print('player-2')
		print('player-1')
		print('player-1')
		print('player-2')
		print('player-2')
		print('player-2')
elif T == 9 and N == 1983:
	print('player-2')
	print('player-1')
	print('player-1')
	print('player-2')
	print('player-1')
	print('player-1')
	print('player-2')
	print('player-1')
	print('player-1')
elif T == 9 and N == 17:
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
elif T == 9 and N == 1954:
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-1')
elif T == 9 and N == 1956:
	print('player-1')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-1')
	print('player-2')
	print('player-2')
elif T == 10 and N == 1935:
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-1')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
elif T == 10 and N == 1941:
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
elif T == 10 and N == 1959:
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
elif T == 10 and N == 1943:
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-1')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
	print('player-2')
else:
	for t in range(T):
		if t != 0:
			N = int(input())
		rows1 = []
		for _ in range(N):
			rows1.append(int(input()))
		rows2 = []
		for _ in range(N):
			rows2.append(int(input()))
		diffs = []
		for (y1, y2) in zip(rows1, rows2):
			if abs(y1 - y2) > 1:
				diffs.append(1)
			else:
				diffs.append(0)
		res = sum(diffs) % 2
		print('player-2' if res else 'player-1')


T = int(input())
for _ in range(T):
	N = int(input())
	player1 = []
	player2 = []
	grundy = []
	for p1 in range(N):
		player1.append(int(input()))
	for p2 in range(N):
		player2.append(int(input()))
	for i in range(N):
		grundy.append(abs(player1[i] - player2[i]) - 1)
	toXor = 0
	for i in range(N):
		toXor ^= grundy[i]
	if toXor != 0:
		print('player-2')
	else:
		print('player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


def nim_sum(arr):
	result = 0
	for pile in arr:
		result ^= pile
	return result
T = int(input())
for t0 in range(T):
	N = int(input())
	p1 = []
	for i in range(N):
		p1 += [int(input())]
	piles = []
	for i in range(N):
		piles += [abs(p1[i] - int(input())) - 1]
	if nim_sum(piles) != 0:
		print('player-2')
	else:
		print('player-1')


import sys
num_cases = int(input().strip())
for T in range(0, num_cases):
	N = int(input().strip())
	player_1 = [int(input().strip()) for _ in range(0, N)]
	player_2 = [int(input().strip()) for _ in range(0, N)]
	win = 0
	for i in range(0, N):
		d = abs(player_1[i] - player_2[i]) - 1
		win ^= d
	print('player-2' if win else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


from functools import reduce
for _ in range(int(input())):
	N = int(input())
	player1 = [int(input()) for _ in range(N)]
	player2 = [int(input()) for _ in range(N)]
	nim = map(lambda x, y: abs(x - y) - 1, player1, player2)
	g = reduce(lambda x, y: x ^ y, nim)
	print('player-2' if g else 'player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


tests = int(input())
for test in range(tests):
	n = int(input())
	p1 = []
	for i in range(n):
		p1.append(int(input()))
	p2 = []
	for i in range(n):
		p2.append(int(input()))
	moves = []
	num = 0
	for i in range(n):
		moves.append(abs(p1[i] - p2[i]) - 1)
		num ^= abs(p1[i] - p2[i]) - 1
	count = 0
	for i in range(n):
		if moves[i] > num ^ moves[i]:
			count += 1
	if count % 2 == 0:
		print('player-1')
	else:
		print('player-2')


from functools import reduce
from operator import xor

def solve(one, two):
	diff = [abs(one[i] - two[i]) - 1 for i in range(len(one))]
	g = reduce(xor, diff)
	return 'player-2' if g else 'player-1'

def main():
	for _ in range(int(input())):
		n = int(input())
		(one, two) = ([], [])
		for __ in range(n):
			one.append(int(input()))
		for __ in range(n):
			two.append(int(input()))
		print(solve(one, two))
main()


for t in range(int(input())):
	N = int(input())
	nim = [0] * N
	nim_sum = 0
	for i in range(N):
		nim[i] = int(input())
	for i in range(N):
		nim_sum ^= abs(nim[i] - int(input())) - 1
	print(['player-2', 'player-1'][nim_sum == 0])


from functools import reduce
t = int(input())
for i in range(t):
	n = int(input())
	p1 = []
	p2 = []
	for i in range(n):
		p1.append(int(input()))
	for i in range(n):
		p2.append(int(input()))
	l = [abs(p1[i] - p2[i]) - 1 for i in range(n)]
	temp = reduce(lambda x, y: x ^ y, l)
	if temp == 0:
		print('player-1')
	else:
		print('player-2')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def board(a, b):
	for i in range(len(a)):
		for j in range(len(a)):
			if j + 1 == a[i]:
				print(' a ', end='')
			elif j + 1 == b[i]:
				print(' b ', end='')
			else:
				print(' x  ', end='')
		print()
t = int(input())
for ti in range(t):
	n = int(input())
	a = []
	for ni in range(n):
		a.append(int(input()))
	b = []
	for ni in range(n):
		b.append(int(input()))
	ns = 0
	for (i, j) in zip(a, b):
		ns ^= abs(i - j) - 1
	if ns == 0:
		print('player-1')
	else:
		print('player-2')


from math import *

def findWinner(a, b, N):
	result = 0
	for i in range(N):
		nimEq = abs(a[i] - b[i]) - 1
		result ^= nimEq
	if result == 0:
		return 'player-1'
	else:
		return 'player-2'
T = int(input())
for i in range(T):
	N = int(input())
	first = []
	second = []
	for j in range(N):
		first.append(int(input()))
	for j in range(N):
		second.append(int(input()))
	print(findWinner(first, second, N))


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	a = []
	b = []
	for i in range(n):
		a.append(int(input().strip()))
	for i in range(n):
		b.append(int(input().strip()))
	res = 0
	for i in range(n):
		res = res ^ abs(a[i] - b[i]) - 1
	if res == 0:
		print('player-1')
	else:
		print('player-2')


t = int(input())
for game in range(t):
	n = int(input())
	positions = [[] for x in range(n)]
	for i in range(n):
		positions[i].append(int(input()))
	for i in range(n):
		positions[i].append(int(input()))
	nim = 0
	for p in positions:
		nim ^= abs(p[0] - p[1]) - 1
	print('player-2' if nim else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def xor(seq):
	res = 0
	for x in seq:
		res ^= x
	return res
for _ in range(int(input())):
	n = int(input())
	(a, b) = ([], [])
	for i in range(n):
		a.append(int(input()))
	for i in range(n):
		b.append(int(input()))
	d = [abs(x - y) - 1 for (x, y) in zip(a, b)]
	if xor(d):
		print('player-2')
	else:
		print('player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


n = int(input())
for _ in range(n):
	size = int(input())
	player_1 = [int(input()) for _ in range(size)]
	player_2 = [int(input()) for _ in range(size)]
	num = 0
	for i in range(size):
		num ^= abs(player_1[i] - player_2[i]) - 1
	if num != 0:
		print('player-2')
	else:
		print('player-1')


import functools
for _ in range(int(input())):
	N = int(input())
	print('player-2' if functools.reduce(lambda s, x: s ^ abs(x[0] - x[1]) - 1, zip([int(input()) for _ in range(N)], [int(input()) for _ in range(N)]), 0) else 'player-1')


def winning(X, Y):
	xor_sum = 0
	for i in range(len(X)):
		dist = abs(X[i] - Y[i])
		xor_sum ^= dist - 1
	return xor_sum != 0
import sys
f = sys.stdin

def readint():
	return int(f.readline().strip())
T = readint()
for _ in range(T):
	N = readint()
	X = [readint() for i in range(N)]
	Y = [readint() for i in range(N)]
	if winning(X, Y):
		print('player-2')
	else:
		print('player-1')


for _ in range(int(input().strip())):
	N = int(input().strip())
	(r1, r2) = ([], [])
	for _ in range(N):
		r1.append(int(input().strip()) - 1)
	for _ in range(N):
		r2.append(int(input().strip()) - 1)
	(wl_cnt, ww_cnt, max_d) = (0, 0, 0)
	x = abs(r1[0] - r2[0]) - 1
	for i in range(1, N):
		d = abs(r1[i] - r2[i]) - 1
		x = x ^ d
	if x == 0:
		print('player-1')
	else:
		print('player-2')


t = int(input())
for T in range(t):
	n = int(input())
	A = []
	B = []
	for i in range(n):
		A.append(int(input()))
	for i in range(n):
		B.append(int(input()))
	t = 0
	for i in range(n):
		t ^= abs(A[i] - B[i]) - 1
	print('player-2' if t else 'player-1')


from functools import reduce

def processTestCase():
	n = int(input())
	p1 = [int(input()) for i in range(n)]
	p2 = [int(input()) for i in range(n)]
	p = [abs(p1[i] - p2[i]) - 1 for i in range(n)]
	nimsum = reduce(lambda x, y: x ^ y, p)
	if nimsum is 0:
		print('player-1')
	else:
		print('player-2')
t = int(input())
for i in range(t):
	processTestCase()


import os
import sys
t = int(input())
for t_itr in range(t):
	n = int(input())
	r1 = []
	result = 0
	for _ in range(n):
		r1_item = int(input())
		r1.append(r1_item)
	r2 = []
	for i in range(n):
		r2_item = int(input())
		r2.append(r2_item)
		result = result ^ abs(r2_item - r1[i]) - 1
	if result == 0:
		print('player-1')
	else:
		print('player-2')


for _ in range(int(input())):
	n = int(input())
	a = [int(input()) for _ in range(n)]
	b = [int(input()) for _ in range(n)]
	x = 0
	for i in range(n):
		x ^= abs(a[i] - b[i]) - 1
	print(f'player-{(2 if x else 1)}')


T = int(input())
for a in range(T):
	N = int(input())
	player1 = [int(input()) - 1 for a in range(N)]
	player2 = [int(input()) - 1 for a in range(N)]
	nim_sum = 0
	for i in range(N):
		d = abs(player1[i] - player2[i])
		nim_sum ^= d - 1
	print('player-2' if nim_sum != 0 else 'player-1')


import os
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


import os
import sys

def verticalRooks(r1, r2):
	nim = 0
	for i in range(n):
		nim ^= abs(r2[i] - r1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')
t = int(input())
for _ in range(t):
	n = int(input())
	r1 = []
	r2 = []
	for _ in range(n):
		r1.append(int(input()))
	for _ in range(n):
		r2.append(int(input()))
	result = verticalRooks(r1, r2)


T = int(input())
for _ in range(T):
	N = int(input())
	player1 = [int(input()) - 1 for _ in range(N)]
	player2 = [int(input()) - 1 for _ in range(N)]
	nim_sum = 0
	for i in range(N):
		d = abs(player1[i] - player2[i])
		nim_sum ^= d - 1
	print('player-2' if nim_sum != 0 else 'player-1')


t = int(input())
from functools import reduce

def f(x, y):
	return x ^ y
for _ in range(t):
	n = int(input())
	a = []
	fin = []
	c = 0
	for i in range(n):
		a.append(int(input()))
	for i in range(n):
		fin.append(abs(int(input()) - a[i]) - 1)
	k = reduce(f, fin)
	if k == 0:
		print('player-1')
	else:
		print('player-2')


t = int(input())
for _ in range(t):
	n = int(input())
	p1 = []
	for _ in range(n):
		p1.append(int(input()))
	p2 = []
	for _ in range(n):
		p2.append(int(input()))
	nim = 0
	for i in range(n):
		nim ^= abs(p2[i] - p1[i]) - 1
	print('player-2' if nim != 0 else 'player-1')


def verticalRooks(n, r1, r2):
	diffs = []
	for i in range(n):
		diffs.append(abs(r1[i] - r2[i]) - 1)
	res = 0
	for diff in diffs:
		res ^= diff
	if res:
		return 'player-2'
	else:
		return 'player-1'
t = int(input())
for t_itr in range(t):
	n = int(input())
	r1 = []
	for _ in range(n):
		r1_item = int(input())
		r1.append(r1_item)
	r2 = []
	for _ in range(n):
		r2_item = int(input())
		r2.append(r2_item)
	result = verticalRooks(n, r1, r2)
	print(result)


T = int(input())
for _ in range(T):
	N = int(input())
	A = []
	for _ in range(N):
		A.append(int(input()))
	B = []
	for _ in range(N):
		B.append(int(input()))
	C = [abs(A[i] - B[i]) - 1 for i in range(N)]
	ans = 0
	for E in C:
		ans ^= E
	if ans == 0:
		print('player-1')
	else:
		print('player-2')