Nim is the most famous two-player algorithm game. The basic rules for this game are as follows:

The game starts with a number of piles of stones.  The number of stones in each pile may not be equal.
The players alternately pick up $\mbox{1}$ or more stones from $\mbox{1}$ pile
The player to remove the last stone wins.

For example, there are $n=3$ piles of stones having $pile=[3,2,4]$ stones in them.  Play may proceed as follows:

Player  Takes           Leaving
                        pile=[3,2,4]
1       2 from pile[1]  pile=[3,4]
2       2 from pile[1]  pile=[3,2]
1       1 from pile[0]  pile=[2,2]
2       1 from pile[0]  pile=[1,2]
1       1 from pile[1]  pile=[1,1]
2       1 from pile[0]  pile=[0,1]
1       1 from pile[1]  WIN

Given the value of $n$ and the number of stones in each pile, determine the game's winner if both players play optimally.

Function Desctription  

Complete the nimGame function in the editor below.  It should return a string, either First or Second.  

nimGame has the following parameter(s):  

pile: an integer array that represents the number of stones in each pile  

Input Format

The first line contains an integer, $\mathrm{~g~}$, denoting the number of games they play.

Each of the next $\mathrm{~g~}$ pairs of lines is as follows:  

The first line contains an integer $n$, the number of piles.
The next line contains $n$ space-separated integers $pile[i]$, the number of stones in each pile.

Constraints

$1\leq g\leq100$
$1\leq n\leq100$
$0\leq s_i\leq100$
Player 1 always goes first.

Output Format

For each game, print the name of the winner on a new line (i.e., either First or Second).

Sample Input
2
2
1 1
3
2 1 4

Sample Output
Second
First

Explanation

In the first case, there are $n=2$ piles of $pile=[1,1]$ stones.  Player $\mbox{1}$ has to remove one pile on the first move.  Player $2$ removes the second for a win.

In the second case, there are $n=3$ piles of $pile=[2,1,4]$ stones.  If player $\mbox{1}$ removes any one pile, player $2$ can remove all but one of another pile and force a win.  If player $\mbox{1}$ removes less than a pile, in any case, player $2$ can force a win as well, given optimal play.

Source: hackerrank | Difficulty: EASY
Tags: Game theory


Solutions:
test = int(input())
for _ in range(test):
	pile = int(input())
	ar = list(map(int, input().strip().split()))
	xor = 0
	for n in ar:
		xor = xor ^ n
	if xor == 0:
		print('Second')
	else:
		print('First')


for _ in range(int(input())):
	input()
	xor = 0
	for e in map(int, input().split()):
		xor ^= e
	print('First' if xor else 'Second')


for t in range(int(input())):
	n = int(input())
	x = [int(a) for a in input().split()]
	s = 0
	for i in x:
		s ^= i
	if s == 0:
		print('Second')
	else:
		print('First')


import functools
for _ in range(int(input())):
	input()
	print('First' if functools.reduce(lambda x, y: x ^ y, list(map(int, input().split()))) != 0 else 'Second')


def nim_sum(a, n):
	ans = 0
	for i in range(n):
		ans = ans ^ a[i]
	return ans
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	if nim_sum(a, n) != 0:
		print('First')
	else:
		print('Second')


import sys

def ints():
	return map(int, sys.stdin.readline().split())
[t] = ints()
for i in range(0, t):
	[n] = ints()
	a = 0
	for j in ints():
		a ^= j
	if a == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
T = int(input())
while T > 0:
	N = int(input())
	piles = list(map(int, input().split()))
	piles_xor = reduce(lambda x, y: x ^ y, piles)
	if piles_xor != 0:
		print('First')
	else:
		print('Second')
	T -= 1


from functools import reduce
test = int(input().strip())
for each in range(test):
	n = int(input().strip())
	arr = [int(i) for i in input().strip().split(' ')]
	g = int(reduce(lambda a, b: a ^ b, arr))
	if g == 0:
		print('Second')
	else:
		print('First')


for i in range(int(input())):
	input()
	(n, a) = (0, map(int, input().split()))
	for j in a:
		n ^= j
	print('First' if n else 'Second')


cases = int(input())
for j in range(cases):
	N = int(input())
	D = list(map(int, input().split(' ')))
	s = D[0]
	for i in range(1, N):
		s = s ^ D[i]
	if s == 0:
		print('Second')
	else:
		print('First')


import sys
for _ in range(int(input())):
	n = input()
	if int(n) > 0 and int(n) < 101:
		heaps = input().split(' ')
		xor = int(heaps[0])
		for d in range(1, int(n)):
			xor ^= int(heaps[d])
		if xor == 0:
			print('Second')
		else:
			print('First')


t = int(input().strip())
for t0 in range(t):
	nim_sum = 0
	int(input().strip())
	arr = [int(x) for x in input().strip().split(' ') if int(x) > 0]
	for n in arr:
		nim_sum = nim_sum ^ n
	if nim_sum != 0:
		print('First')
	else:
		print('Second')


def testEnding(P):
	num = P.count(1)
	L = len(P) - P.count(0)
	if num == L and num % 2 == 0:
		print('Second')
		return True
	elif num == L and num % 2 != 0:
		print('First')
		return True
	return False
for _ in range(int(input())):
	N = int(input())
	butterfly = False
	P = [int(r) for r in input().split(' ')]
	s = P[0]
	if not testEnding(P):
		for i in range(1, N):
			s ^= P[i]
		if s == 0:
			print('Second')
		else:
			print('First')


for i in range(int(input())):
	n = int(input())
	rows = [int(x) for x in input().split()]
	if n == 1:
		print('First')
		continue
	result = 0
	for i in rows:
		result = i ^ result
	if result == 0:
		print('Second')
	else:
		print('First')


def find(a):
	s = a[0]
	for i in range(1, len(a)):
		s ^= a[i]
	if s == 0:
		return 'Second'
	else:
		return 'First'
for _ in range(int(input())):
	n = int(input())
	my_list = [int(i) for i in input().strip().split()]
	print(find(my_list))


def find(a):
	s = a[0]
	for i in range(1, len(a)):
		s ^= a[i]
	if s == 0:
		return 'Second'
	else:
		return 'First'
for _ in range(int(input())):
	n = input()
	my_list = list(map(int, input().split()))
	print(find(my_list))


t = int(input())
for _ in range(t):
	n = int(input())
	m = [int(x) for x in input().split()]
	a = 0
	for x in m:
		a ^= x
	if a == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
for _ in range(int(input())):
	_ = input()
	s = (int(x) for x in input().split(' '))
	print('First' if reduce(lambda x, y: x ^ y, s) else 'Second')


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = a[0]
	for i in range(1, n):
		s = s ^ a[i]
	if s == 0:
		print('Second')
	else:
		print('First')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split() if x != '0']
	k = 0
	for x in l:
		k ^= x
	if k == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
T = int(input())
while T:
	input()
	print('First' if reduce(lambda x, y: x ^ y, [int(x) for x in input().split()]) else 'Second')
	T += -1


T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	A = [int(a) for a in input().strip().split(' ')]
	tot = A[0]
	for i in range(1, N):
		tot ^= A[i]
	if tot != 0:
		print('First')
	else:
		print('Second')


def find(a):
	a = list(a)
	s = a[0]
	for i in range(1, len(a)):
		s ^= a[i]
	if s == 0:
		return 'Second'
	else:
		return 'First'
f = int(input())
for j in range(f):
	n = input()
	my_list = map(int, input().split())
	print(find(my_list))


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	nimsum = 0
	for i in arr:
		nimsum ^= i
	if nimsum == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


t = int(input())
for i in range(t):
	n = int(input())
	li = list(input().split())
	li = [int(m) for m in li]
	xor = 0
	for k in li:
		xor ^= k
	if xor == 0:
		print('Second')
	else:
		print('First')


for _ in range(int(input())):
	input()
	x = 0
	for i in map(int, input().split()):
		x ^= i
	print('First' if x else 'Second')


def getWinner(n):
	s = n[0]
	for x in range(1, len(n)):
		s ^= n[x]
	if s == 0:
		return 'Second'
	else:
		return 'First'
t = int(input())
if t > 0 and t <= 100:
	for _ in range(t):
		n = int(input())
		if n > 0 and n <= 100:
			s = input()
			towers = list(map(int, s.split(' ')))
			print(getWinner(towers))


import sys
from operator import xor
from functools import reduce
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	print('First' if reduce(lambda i, j: xor(i, j), [int(i) for i in input().split(' ')]) else 'Second')


from functools import reduce
g = int(input())
for _ in range(g):
	_ = input()
	if reduce(lambda a, b: a ^ b, [int(raw_stones) for raw_stones in input().split(' ')]) != 0:
		print('First')
	else:
		print('Second')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


G = int(input())
for g in range(G):
	N = int(input())
	boxes = [int(x) for x in input().split()]
	out = 0
	for x in boxes:
		out ^= x
	if out == 0:
		print('Second')
	else:
		print('First')


for _ in range(int(input().strip())):
	n = input()
	res = 0
	for z in [int(y) for y in input().split()]:
		res ^= z
	if res == 0:
		print('Second')
	else:
		print('First')


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	ans = arr[0]
	for a in arr[1:]:
		ans = ans ^ a
	if ans == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


n = int(input())
for i in range(n):
	p = int(input())
	a = list(map(int, input().split()))
	s = a[0]
	for i in range(1, len(a)):
		s ^= a[i]
	if s == 0:
		print('Second')
	else:
		print('First')


num_games = int(input())
for game in range(num_games):
	num_piles = int(input())
	pile = [int(x) for x in input().split()]
	xor = 0
	for x in pile:
		xor ^= x
	if xor == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


for _ in range(int(input())):
	n = int(input())
	x = 0
	for s in input().split():
		x ^= int(s)
	print('First' if x else 'Second')


t = int(input())
for _ in range(t):
	n = int(input())
	ar = [int(i) for i in input().split()]
	ans = ar[0]
	for i in range(1, len(ar)):
		ans = ans ^ ar[i]
	if ans == 0:
		print('Second')
	else:
		print('First')


t = int(input())
for i in range(t):
	n = int(input())
	piles = [int(x) for x in input().split()]
	xor = 0
	for i in range(n):
		xor ^= piles[i]
	if xor == 0:
		print('Second')
	else:
		print('First')


t = int(input())
for _ in range(t):
	n = int(input())
	c = [int(i) for i in input().split()]
	nim_sum = 0
	for s in c:
		nim_sum = int.__xor__(nim_sum, s)
	for s in c:
		if s > int.__xor__(nim_sum, s):
			print('First')
			break
	else:
		print('Second')


import functools
import operator
g = int(input())
for _ in range(g):
	_ = int(input())
	xor_value = functools.reduce(operator.xor, [int(x) for x in input().split()])
	print('First' if xor_value != 0 else 'Second')


import sys
g = int(input().strip())
for game in range(g):
	n = int(input().strip())
	s = [int(arr_temp) for arr_temp in input().strip().split(' ')]
	sum = 0
	tot = 0
	for i in s:
		sum = sum ^ i
		tot += i
	if n > 1:
		if sum == 0:
			print('Second')
		else:
			print('First')
	elif tot > 1:
		print('First')
	else:
		print('Second')


n = int(input())
for _ in range(n):
	input()
	ar = [int(i) for i in input().split(' ')]
	xor = 0
	for i in ar:
		xor ^= i
	print('Second' if xor == 0 else 'First')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


g = int(input())
for _ in range(g):
	n = int(input())
	arr = [int(i) for i in input().split()]
	total = 0
	for i in arr:
		total ^= i
	if total == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


for g in range(0, int(input().strip())):
	nP = int(input().strip())
	res = 0
	for p in map(int, input().split(' ')):
		res = res ^ p
	print('First' if res > 0 else 'Second')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


g = int(input().strip())
for g_ in range(g):
	n = input()
	S = (int(x) for x in input().split())
	n_sum = 0
	for s in S:
		n_sum ^= s
	if n_sum != 0:
		print('First')
	else:
		print('Second')


for g in range(int(input())):
	input()
	n = map(int, input().split())
	a = 0
	for i in n:
		a = a ^ i
	if a == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	piles = list(map(int, input().split()))
	if reduce(lambda x, y: x ^ y, piles) == 0:
		print('Second')
	else:
		print('First')


t = int(input())
for z in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	res = 0
	for i in range(n):
		res = res ^ l[i]
	if res == 0:
		print('Second')
	else:
		print('First')


t = int(input())
for z in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	res = 0
	for i in range(n):
		res = res ^ l[i]
	if res == 0:
		print('Second')
	else:
		print('First')


t = int(input())
for _ in range(t):
	a = 0
	b = input()
	for i in input().split():
		a ^= int(i)
	if a:
		print('First')
	else:
		print('Second')


import operator
from functools import reduce

def get_winner(stones):
	return 2 if reduce(operator.xor, stones) == 0 else 1
g = int(input())
for _ in range(g):
	_ = input()
	stones = [int(s) for s in input().split()]
	print('First' if get_winner(stones) == 1 else 'Second')


from functools import reduce
from operator import xor
for testcase in range(int(input())):
	n = int(input())
	piles = list(map(int, input().split()))
	winner = reduce(xor, piles)
	print(winner and 'First' or 'Second')


g = int(input().strip())
s = []
n = []
for i in range(g):
	n.append(int(input().strip()))
	s_t = [int(s_temp) for s_temp in input().strip().split(' ')]
	s.append(s_t)
for i in range(g):
	res = s[i][0]
	for j in range(1, len(s[i])):
		res = res ^ s[i][j]
	if res != 0:
		print('First')
	else:
		print('Second')


def won(piles, n):
	nim = 0
	for pile in piles:
		nim ^= pile
	if nim == 0:
		return False
	else:
		return True
q = int(input())
for _ in range(q):
	n = int(input())
	piles = map(int, input().split())
	if won(piles, n):
		print('First')
	else:
		print('Second')


q = int(input())
for x in range(q):
	n = int(input())
	m = [int(y) for y in input().split()]
	s = 0
	for mm in m:
		s ^= mm
	print('First') if s else print('Second')


n = int(input().strip())
for _ in range(n):
	piles = int(input().strip())
	temp = [int(x) for x in input().strip().split(' ')]
	winner = 0
	for x in temp:
		winner ^= x
	print('First' if winner else 'Second')


from functools import reduce
print('\n'.join(map(lambda x: 'First' if reduce(int.__xor__, x[1]) else 'Second', ((input(), map(int, input().split())) for _ in range(int(input()))))))


for _ in range(int(input())):
	n = int(input())
	result = 0
	for val in input().strip().split():
		result ^= int(val)
	print('First' if result else 'Second')


import operator
for _ in range(int(input())):
	n = int(input())
	r = 0
	for x in list(map(int, input().split())):
		r = r ^ x
	print('Second' if r == 0 else 'First')


import functools
t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	if functools.reduce(lambda x, y: x ^ y, s) == 0:
		print('Second')
	else:
		print('First')


g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	arr = [int(a) for a in input().split()]
	val = 0
	for i in arr:
		val = val ^ i
	if val == 0:
		print('Second')
	else:
		print('First')


g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	p = [int(tmp) for tmp in input().strip().split(' ')]
	xor = 0
	for i in range(n):
		xor = xor ^ p[i]
	print('First' if xor else 'Second')


g = int(input().strip())
for g0 in range(g):
	n = int(input().strip())
	l = list(map(int, input().strip().split(' ')))
	xor = 0
	for num in l:
		xor ^= num
	if xor == 0:
		print('Second')
	else:
		print('First')


games = int(input().strip())
for _ in range(games):
	n = int(input().strip())
	piles = [int(x) for x in input().strip().split()]
	xor = 0
	for p in piles:
		xor ^= p
	if xor == 0:
		print('Second')
	else:
		print('First')


g = int(input())
for _ in range(g):
	n = map(int, input().split())
	l = list(map(int, input().split()))
	num = 0
	for i in l:
		num = num ^ i
	print('First' if num != 0 else 'Second')


numTests = int(input())
for test in range(numTests):
	numPiles = int(input())
	piles = [int(pile) for pile in input().split(' ')]
	xor = 0
	for pile in piles:
		xor ^= pile
	if xor == 0:
		print('Second')
	else:
		print('First')


T = int(input())
for t in range(T):
	n = int(input())
	arr = [int(x) for x in input().strip().split()]
	check = 0
	for a in arr:
		check ^= a
	if check == 0:
		print('Second')
	else:
		print('First')


g = int(input())
while g > 0:
	g -= 1
	n = int(input())
	l = [int(x) for x in input().strip().split(' ')]
	s = 0
	for x in l:
		s ^= x
	if s == 0:
		print('Second')
	else:
		print('First')


def main():
	for _ in range(int(input())):
		n = int(input())
		stones = list(map(int, input().split()))
		ans = 0
		for stone in stones:
			ans ^= stone
		print('First' if ans else 'Second')
main()


g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	lst = [int(num) for num in input().split()]
	nimsum = 0
	for num in lst:
		nimsum ^= num
	print('First' if nimsum != 0 else 'Second')


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	res = s[0]
	for i in range(1, n):
		res ^= s[i]
	if res == 0:
		print('Second')
	else:
		print('First')


T = int(input())
for _ in range(T):
	n = int(input())
	lst = [int(i) for i in input().split()]
	ans = lst[0]
	for (i, k) in enumerate(lst):
		if i == 0:
			continue
		ans ^= k
	if ans != 0:
		print('First')
	else:
		print('Second')


n = int(input())
for i in range(n):
	t = int(input())
	l = list(map(int, input().split(' ')))
	c = 0
	for j in range(len(l)):
		c ^= l[j]
	if c == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	S = [int(x) for x in input().split()]
	print('Second' if reduce(lambda x, y: x ^ y, S) == 0 else 'First')


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	print('First' if reduce(lambda x, y: x ^ y, [int(v) for v in input().strip().split()]) != 0 else 'Second')


for i in range(int(input())):
	m = int(input())
	ans = 0
	n = [int(i) for i in input().split(' ')]
	for i in range(len(n)):
		ans ^= n[i]
	if ans:
		print('First')
	else:
		print('Second')


test = int(input())
for _ in range(test):
	pile = int(input())
	ar = list(map(int, input().strip().split()))
	xor = 0
	for n in ar:
		xor = xor ^ n
	if xor == 0:
		print('Second')
	else:
		print('First')


g = int(input())
for i in range(g):
	n = int(input())
	s = [int(t) for t in input().strip().split(' ')]
	for j in range(1, n):
		s[j] = s[j] ^ s[j - 1]
	if s[n - 1] == 0:
		print('Second')
	else:
		print('First')


g = int(input().strip())
for _ in range(g):
	n = int(input().strip())
	s = [int(x) for x in input().strip().split(' ')]
	x = 0
	for i in s:
		x ^= i
	if x:
		print('First')
	else:
		print('Second')


from functools import reduce
g = int(input())
for i in range(g):
	n = int(input())
	l = [int(i) for i in input().split()]
	temp = reduce(lambda x, y: x ^ y, l)
	if temp == 0:
		print('Second')
	else:
		print('First')


import sys

def nim_score(heaps):
	x = 0
	for i in heaps:
		x ^= i
	return x

def can_win(heaps):
	if 0 in heaps:
		del heaps[heaps.index(0)]
		return can_win(heaps)
	n = len(heaps)
	if n == 0:
		return -1
	x = nim_score(heaps)
	if x == 0:
		return -1 if n % 2 == 0 else 1
	elif x in heaps:
		heaps.remove(x)
		return -can_win(heaps)
	else:
		target = None
		for i in range(n):
			if x ^ heaps[i] < heaps[i]:
				target = i
				break
		heaps[target] ^= x
		return -can_win(heaps)

def can_win_2(heaps):
	heaps = [i + 1 for i in heaps]
	return can_win_basic(heaps)

def can_win_basic(heaps):
	n = len(heaps)
	x = nim_score(heaps)
	if x == 0:
		return -1
	else:
		return 1

def can_win_3(heaps):
	n = len(heaps)
	hats = [1] * n
	return sub_can_win_3(heaps, hats)

def sub_can_win_3(heaps, hats):
	if 0 in heaps:
		del heaps[heaps.index(0)]
		return can_win(heaps)
	n = len(heaps)
	if n == 0:
		return -1
	x = nim_score(heaps)
	if x == 0:
		if 1 in hats:
			hats[hats.index(1)] = 0
			return -sub_can_win_3(heaps, hats)
		else:
			return can_win_basic(heaps)
	elif 1 not in hats:
		return can_win_basic(heaps)
	else:
		target = None
		for i in range(n):
			if x ^ heaps[i] <= heaps[i]:
				target = i
				break
		heaps[target] ^= x
		if heaps[target] == 0:
			del heaps[target]
			del hats[target]
		return -sub_can_win_3(heaps, hats)

def can_win_4(heaps):
	heaps = [(i << 1) + 1 for i in heaps]
	return sub_can_win_4(heaps)

def sub_can_win_4(heaps):
	if 0 in heaps:
		del heaps[heaps.index(0)]
		return can_win(heaps)
	if 1 in heaps:
		del heaps[heaps.index(1)]
		return can_win(heaps)
	n = len(heaps)
	if n == 0:
		return -1
	x = nim_score(heaps)
	if x == 0:
		del heaps[0]
		return -sub_can_win_4(heaps)
	else:
		target = None
		if x in heaps:
			target = heaps.index(x)
		i = 0
		while target == None and i < n:
			if x ^ heaps[i] <= heaps[i]:
				target = i
				break
			i += 1
		heaps[target] ^= x
		return -sub_can_win_4(heaps)

def can_win_5(heaps):
	heaps = [(i << 1) + 1 if i > 0 else 0 for i in heaps]
	return can_win_basic(heaps)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	p = [int(p_temp) for p_temp in input().strip().split(' ')]
	print('First' if can_win_basic(p) == 1 else 'Second')


import sys
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	p = [int(p_temp) for p_temp in input().strip().split(' ')]
	a = p[0]
	for i in range(1, n):
		a = a ^ p[i]
	if a == 0:
		print('Second')
	else:
		print('First')


from operator import xor
query = int(input().strip())
for i in range(query):
	num_piles = int(input().strip())
	piles = [int(x) for x in input().strip().split(' ')]
	if len(piles) == 1:
		print('First')
	else:
		result = xor(piles[0], piles[1])
		for item in piles[2:]:
			result = xor(result, item)
		if result == 0:
			print('Second')
		else:
			print('First')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	m = a[0]
	for i in range(1, n):
		m = m ^ a[i]
	if m != 0:
		print('First')
	else:
		print('Second')


g = int(input())
for game in range(g):
	n = int(input())
	piles = input().split()
	xor = 0
	for pile in piles:
		xor = xor ^ int(pile)
	if xor == 0:
		print('Second')
	else:
		print('First')


game_count = int(input())
for i in range(game_count):
	tmp = input()
	piles = [int(x) for x in input().strip().split(' ')]
	bits = 0
	for p in piles:
		bits ^= p
	if bits != 0 and max(piles) > 1:
		print('First')
	else:
		print('Second')


def outcome(p):
	result = p[0]
	for e in p[1:]:
		result ^= e
	return result != 0
g = int(input().strip())
for g_i in range(g):
	outcomes = {}
	n = int(input().strip())
	p = list(map(int, input().strip().split()))
	p.sort(reverse=True)
	if outcome(p):
		print('First')
	else:
		print('Second')


from functools import reduce
from operator import xor
for _ in range(int(input().strip())):
	input()
	print('First' if reduce(xor, map(int, input().strip().split(' '))) else 'Second')


def SG(x):
	return x

def mex(n):
	i = 0
	s = set(n)
	while i in s:
		i += 1
	return i

def F(x):
	lis = list(range(1, x))
	return lis
t = int(input().strip())
while t > 0:
	hSize = int(input().strip())
	arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
	nimsum = 0
	for val in arr:
		nimsum = nimsum ^ val
	if nimsum == 0:
		print('Second')
	else:
		print('First')
	t -= 1