Two people are playing game of Misère Nim. The basic rules for this game are as follows:

The game starts with $n$ piles of stones indexed from $o$ to $n-1$. Each pile $i$ (where $0\leq i<n$) has $s_i$ stones.
The players move in alternating turns. During each move, the current player must  remove one or more stones from a single pile. 
The player who removes the last stone loses the game.

Given the value of $n$ and the number of stones in each pile, determine whether the person who wins the game is the first or second person to move. If the first player to move wins, print First on a new line; otherwise, print Second. Assume both players move optimally.  

Example 

$s=[1,1,1]$  

In this case, player 1 picks a pile, player 2 picks a pile and player 1 has to choose the last pile.  Player 2 wins so return Second.  

$s=[1,2,2]$  

There is no permutation of optimal moves where player 2 wins.  For example, player 1 chooses the first pile.  If player 2 chooses 1 from another pile, player 1 will choose the pile with 2 left.  If player 2 chooses a pile of 2, player 1 chooses 1 from the remaining pile leaving the last stone for player 2. Return First.  

Function Description  

Complete the misereNim function in the editor below.  

misereNim has the following parameters:  

int s[n]: the number of stones in each pile   

Returns   

string: either First or Second

Input Format

The first line contains an integer, $T$, the number of test cases. 

Each test case is described over two lines:

An integer, $n$, the number of piles.
$n$ space-separated integers, $s[i]$, that describe the number of stones at pile $i$.

Constraints

$1\leq T\leq100$
$1\le n\le100$
$1\leq s[i]\leq10^{9} $

Sample Input
STDIN   Function
-----   --------
2       T = 2
2       s[] size n = 2
1 1     s = [1, 1]
3       s[] size n = 3
2 1 3   s = [2, 1, 3]

Sample Output
First
Second

Explanation

In the first testcase, the first player removes 1 stone from the first pile and then the second player has no moves other than removing the only stone in the second pile. So first wins.  

In the second testcase, the series of moves can be depicted as:

In every possible move of first player we see that the last stone is picked by him, so second player wins.

Difficulty: EASY
Tags: Game theory

Starter code:

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 ar == [1] * len(ar):
		if len(ar) % 2 == 0:
			print('First')
		else:
			print('Second')
	elif xor == 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()))
	elem_greater_than_one = False
	all_less_than_or_equal_to_one = True
	for pile in piles:
		if pile > 1:
			elem_greater_than_one = True
			all_less_than_or_equal_to_one = False
	piles_xor = reduce(lambda x, y: x ^ y, piles)
	if elem_greater_than_one and piles_xor == 0 or (all_less_than_or_equal_to_one and piles_xor == 1):
		print('Second')
	else:
		print('First')
	T -= 1


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


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


for i in range(int(input())):
	n = int(input())
	rows = [int(x) for x in input().split()]
	exception = True
	for row in rows:
		if row != 1:
			exception = False
			break
	if exception:
		if len(rows) % 2 == 0:
			print('First')
		else:
			print('Second')
		continue
	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, c) = (a[0], 1)
	for i in range(1, len(a)):
		s ^= a[i]
	for i in a:
		if i > 1:
			c = 0
	if s == c:
		return 'Second'
	else:
		return 'First'
for _ in range(int(input())):
	input()
	my_list = list(map(int, input().split()))
	print(find(my_list))


def find(a):
	(s, c) = (a[0], 1)
	for i in range(1, len(a)):
		s ^= a[i]
	for i in a:
		if i > 1:
			c = 0
	if s == c:
		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))


t = int(input())
for _ in range(t):
	n = int(input())
	m = [int(x) for x in input().split()]
	a = 0
	allOnes = True
	for x in m:
		a ^= x
		allOnes &= x <= 1
	if a > 0:
		if allOnes:
			print('Second')
		else:
			print('First')
	elif allOnes:
		print('First')
	else:
		print('Second')


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	a = list(map(int, input().strip().split()))
	bin = 0
	k1 = 0
	for j in range(n):
		bin = bin ^ a[j]
		if a[j] == 1:
			k1 = k1 + 1
	if k1 == n:
		if bin == 0:
			print('First')
		else:
			print('Second')
	elif bin == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
for _ in range(int(input())):
	_ = input()
	nim = 0
	s = [int(x) for x in input().split(' ')]
	if all((x <= 1 for x in s)):
		nim += 1
	print('Second' if reduce(lambda x, y: x ^ y, s) == nim else 'First')


from copy import copy

def nim(l):
	k = 0
	for x in l:
		k ^= x
	if k == 0:
		return 1
	else:
		return 0
for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	k = nim(l)
	algo = 1
	for x in l:
		if x > 1:
			algo = 2
	if algo == 1:
		if k == 1:
			winner = 0
		else:
			winner = 1
	elif k == 0:
		winner = 0
	else:
		winner = 1
	print(('First', 'Second')[winner])


def find(a):
	a = list(a)
	(s, c) = (a[0], 1)
	for i in range(1, len(a)):
		s ^= a[i]
	for i in a:
		if i > 1:
			c = 0
	if s == c:
		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 and max(arr) > 1 or (nimsum == 1 and max(arr) == 1):
		print('Second')
	else:
		print('First')


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


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


from functools import reduce
T = int(input())
for _ in range(T):
	_ = input()
	ss = [int(s) for s in input().split(' ')]
	first_turn = True
	while True:
		ss = [s for s in ss if s > 0]
		one_num = len([s for s in ss if s == 1])
		one_more_num = len([s for s in ss if s > 1])
		if one_more_num == 0:
			if one_num % 2 == 1:
				first_turn = not first_turn
			break
		elif one_more_num == 1:
			break
		else:
			nibsum = reduce(lambda a, b: a ^ b, ss)
			if nibsum > 0:
				for (i, s) in enumerate(ss):
					xor = s ^ nibsum
					if xor <= s:
						ss[i] = xor
						break
			else:
				exists_two_more = len([s for s in ss if s > 2])
				for (i, s) in enumerate(ss):
					if s > 2 or (not exists_two_more and s > 1):
						ss[i] -= 1
						break
		first_turn = not first_turn
	print('First' if first_turn else 'Second')


t = int(input())
for i in range(t):
	output = 'First'
	n = int(input())
	pile = {}
	stones = [int(x) for x in input().split(' ')]
	for j in range(n):
		pile[j] = stones[j]
	counter = 0
	sum_xor = 0
	for pile_key in pile.keys():
		if pile[pile_key] <= 1:
			counter += 1
		sum_xor ^= pile[pile_key]
	if counter == n and sum_xor == 1 or (counter != n and sum_xor == 0):
		output = 'Second'
	print(output)


import sys
T = int(input().strip())
for game in range(T):
	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 tot == n:
			if n % 2 == 0:
				print('First')
			else:
				print('Second')
		elif sum == 0:
			print('Second')
		else:
			print('First')
	elif tot == 1:
		print('Second')
	else:
		print('First')


from functools import reduce
for _ in range(int(input().strip())):
	(__, heaps) = (input(), list(map(int, input().strip().split())))
	print(['First', 'Second'][reduce(lambda x, y: x ^ y, heaps) == all((x <= 1 for x in heaps))])


from functools import reduce
T = int(input().strip())
for t in range(T):
	n = int(input().strip())
	s = [int(x) for x in input().strip().split()]
	nim_sum = reduce(lambda x, y: x ^ y, s)
	if nim_sum == 0 and any([x > 1 for x in s]) or (nim_sum == 1 and all([x <= 1 for x in s])):
		print('Second')
	else:
		print('First')


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


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


def misere_nim(piles):
	xor_piles = 0
	for pile in piles:
		xor_piles ^= pile
	if xor_piles == 0:
		if max(piles) > 1:
			return 'Second'
	elif xor_piles == 1:
		if max(piles) <= 1:
			return 'Second'
	return 'First'
q = int(input())
for _ in range(q):
	__ = input()
	piles = [int(i) for i in input().split()]
	print(misere_nim(piles))


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


import sys
from collections import defaultdict

def main():
	tests = int(input())
	for t in range(0, tests):
		n = int(input())
		piles = [int(i) for i in input().split()]
		numSum = 0
		outcome = 1
		for n in piles:
			if n > 1:
				outcome = 0
			numSum ^= n
		if numSum == outcome:
			print('Second')
		else:
			print('First')
main()


for _ in range(int(input())):
	c = 1
	n = input()
	m = list(map(int, input().split()))
	s = m[0]
	for i in range(1, len(m)):
		s ^= m[i]
	for i in m:
		if i > 1:
			c = 0
			break
	print('First') if s != c else print('Second')


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


from sys import stdin
from functools import reduce
n = int(input().strip())
for i in range(0, n):
	numOfPiles = int(input().strip())
	piles = [int(t) for t in input().strip().split(' ')]
	if max(piles) <= 1:
		print('First') if numOfPiles % 2 == 0 else print('Second')
	else:
		res = reduce(lambda x, y: x ^ y, piles)
		print('Second') if res == 0 else print('First')


tests = int(input())
for test in range(tests):
	(n, a) = (int(input()), [int(x) for x in input().split()])
	num = 0
	for i in range(len(a)):
		num ^= a[i]
	count = 1
	for i in range(len(a)):
		if a[i] > 1:
			count = 0
			break
	if count == num:
		print('Second')
	else:
		print('First')


t = int(input().strip())
for t0 in range(t):
	n = int(input().strip())
	l = list(map(int, input().strip().split(' ')))
	xor = 0
	for num in l:
		xor ^= num
	if all(map(lambda x: x <= 1, l)) and xor == 1:
		print('Second')
	elif xor == 0 and any(map(lambda x: x > 1, l)):
		print('Second')
	else:
		print('First')


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


from functools import reduce

def solve(stones):
	g = reduce(lambda a, b: a ^ b, stones, 0)
	c = 1 if max(stones) == 1 else 0
	if g == c:
		return 'Second'
	else:
		return 'First'

def main():
	for _ in range(int(input())):
		n = input()
		stones = list(map(int, input().split()))
		print(solve(stones))
main()


import sys

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


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	a = [int(v) for v in input().strip().split()]
	b = False
	if len(list(filter(lambda z: z >= 2, a))) == 0:
		b = len(list(filter(lambda z: z == 1, a))) % 2 == 0
	else:
		b = reduce(lambda x, y: x ^ y, a) != 0
	print('First' if b else 'Second')


g = int(input().strip())

def allOne(s):
	flag = True
	for i in s:
		if i > 1:
			flag = False
	return flag
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 allOne(s):
		if x == 1:
			print('Second')
		else:
			print('First')
	elif x == 0:
		print('Second')
	else:
		print('First')


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 == all((x == 1 for x in l)):
		print('Second')
	else:
		print('First')


for _ in range(int(input())):
	n = int(input())
	s = [int(x) for x in input().split()]
	x = 0
	for i in s:
		x ^= i
	if len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	lst = [int(i) for i in input().split()]
	nimsum = 0
	for num in lst:
		nimsum ^= num
	if any((num > 1 for num in lst)):
		print('Second' if nimsum == 0 else 'First')
	elif all((num <= 1 for num in lst)):
		print('Second' if nimsum == 1 else 'First')
	else:
		print('First')


from functools import reduce
from operator import xor
for _ in range(int(input().strip())):
	input()
	a = list(map(int, input().strip().split(' ')))
	r = reduce(xor, a)
	if max(a) > 1:
		print('First' if r else 'Second')
	else:
		print('Second' if 1 == r else 'First')


from functools import reduce
g = int(input().strip())
for game in range(g):
	n = int(input().strip())
	s = list(map(int, input().strip().split()))
	if any((j > 1 for j in s)) and reduce(lambda x, y: x ^ y, s) == 0 or (all((j <= 1 for j in s)) and reduce(lambda x, y: x ^ y, s) == 1):
		print('Second')
	else:
		print('First')


from functools import reduce
for i in range(int(input())):
	m = int(input())
	anz = 0
	count = 0
	s = list(map(int, input().split(' ')))
	anz = reduce(lambda x, y: x ^ y, s)
	for x in s:
		if x <= 1:
			count += 1
	if anz == 0 and count < m or (count == m and anz == 1):
		print('Second')
	else:
		print('First')


g = int(input().strip())
for a in range(g):
	n = int(input().strip())
	p = [int(x) for x in input().strip().split(' ')]
	val = 0
	for i in range(len(p)):
		val ^= p[i]
	if all((x == 1 for x in p)):
		if val == 0:
			print('First')
		else:
			print('Second')
	elif val == 0:
		print('Second')
	else:
		print('First')


T = int(input())
for i in range(T):
	n = int(input())
	s = input().split()
	nim = list(map(int, s))
	nimsum = nim[0]
	for j in range(1, n):
		nimsum = nim[j] ^ nimsum
	if all((x == 1 for x in nim)):
		if nimsum == 0:
			print('First')
		else:
			print('Second')
	elif nimsum == 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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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


t = int(input())
for x in range(t):
	n = int(input())
	a = [int(y) for y in input().strip().split(' ')]
	xor = 0
	sa = sum(a)
	for y in a:
		xor = xor ^ y
	if xor == 0 and sa > n or (xor == 1 and sa == n):
		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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


T = int(input())
a = []
for i in range(T):
	n = int(input())
	s = input().split()
	nim = list(map(int, s))
	nimsum = nim[0]
	for j in range(1, n):
		nimsum = nim[j] ^ nimsum
	if all((x == 1 for x in nim)):
		if nimsum == 0:
			a.append('First')
		else:
			a.append('Second')
	elif nimsum == 0:
		a.append('Second')
	else:
		a.append('First')
for i in range(len(a)):
	print(a[i])


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


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().strip().split()))
	x = 0
	for i in s:
		x ^= i
	if len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


from operator import xor
from functools import reduce
for _ in range(int(input())):
	(_, ar) = (input(), tuple(map(int, input().split())))
	print('First' if bool(reduce(xor, ar, 0)) ^ all((x == 1 for x in ar)) else 'Second')


q = int(input())
for i in range(q):
	n = int(input())
	arr = input().strip().split()
	arr = [int(i) for i in arr]
	total = 0
	for p in range(n):
		total ^= arr[p]
	if (len(set(arr)) == 1) & (1 in arr):
		if total != 0:
			print('Second')
		else:
			print('First')
	elif total == 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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


for i in range(int(input())):
	n = int(input().strip())
	l = list(map(int, input().strip().split()))
	ans = 0
	count = 0
	for j in range(n):
		ans = ans ^ l[j]
		if l[j] <= 1:
			count = count + 1
	if count == n and ans == 1 or (count < n and ans == 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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


from functools import reduce
for _ in range(int(input())):
	(_, lis) = (input(), list(map(int, input().split())))
	if set(lis) == {1}:
		print('First' if len(lis) % 2 == 0 else 'Second')
	else:
		print('Second' if reduce(lambda a, b: a ^ b, lis) == 0 else 'First')


Out = {True: 'Second', False: 'First'}
q = int(input())
for Q in range(q):
	input()
	A = [int(m) for m in input().strip().split()]
	S = 0
	for i1 in A:
		S ^= i1
	if max(A) == 1:
		print(Out[S == 1])
	else:
		print(Out[S == 0])


def firstWins(s):
	if max(s) == 1:
		if sum(s) % 2 == 0:
			return True
		else:
			return False
	x = 0
	for num in s:
		x ^= num
	if x == 0:
		return False
	else:
		return True
t = int(input())
for iT in range(t):
	n = int(input())
	s = [int(_) for _ in input().strip().split()]
	if firstWins(s):
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


g = int(input())
for _ in range(g):
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	total = a[0]
	for i in range(1, n):
		total = total ^ a[i]
	if set(a) == {1}:
		if total == 1:
			print('Second')
		else:
			print('First')
	elif total == 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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


t = int(input().strip())
for a0 in range(t):
	n = int(input().strip())
	piles = [int(temp_p) for temp_p in input().strip().split(' ')]
	if max(piles) == 1:
		if len(piles) % 2 == 0:
			print('First')
		else:
			print('Second')
	else:
		k = 1
		while k < max(piles):
			k *= 2
		win1 = True
		while k > 0 and win1:
			s = 0
			for (i, p) in enumerate(piles):
				if not k > p:
					piles[i] -= k
					s += 1
			if s % 2 == 1:
				win1 = False
			k = int(k / 2)
		if not win1:
			print('First')
		else:
			print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


T = int(input())
for t in range(T):
	n = int(input())
	A = list(map(int, input().split(' ')))
	a = 0
	ct = 0
	for i in A:
		a ^= i
		if a < 2:
			ct += 1
	print('Second') if a == 0 and ct < n or (a == 1 and ct == n) else print('First')


g = int(input())
for _ in range(g):
	n = int(input())
	piles = list(map(int, input().split()))
	xored = 0
	for pile in piles:
		xored ^= pile
	if max(piles) == 1:
		print('Second' if len(piles) % 2 == 1 else 'First')
	else:
		print('Second' if xored == 0 else 'First')


def winning(A):
	if len(A) == 1:
		if A[0] > 1:
			return 1
		else:
			return 0
	key = A[0]
	state = 1
	for i in range(len(A)):
		if i == 0:
			state = state * int(A[i] == 1)
		else:
			key = key ^ A[i]
			state = state * int(A[i] == 1)
	if state == 1:
		if key == 0:
			return 1
		else:
			return 0
	elif key == 0:
		return 0
	else:
		return 1
num = int(input())
for i in range(num):
	input()
	A = list(map(int, input().strip().split(' ')))
	if winning(A) == 1:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


import functools
misere = True

def xor_zero(piles):
	return functools.reduce(lambda x, y: x ^ y, piles) == 0
for _ in range(int(input())):
	n = int(input())
	piles = list(map(int, input().strip().split(' ')))
	if misere and max(piles) == 1:
		if n % 2 == 1:
			print('Second')
		else:
			print('First')
	elif xor_zero(piles):
		print('Second')
	else:
		print('First')


q = int(input())
for _ in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	xor = 0
	for i in p:
		xor = xor ^ i
	total = sum(p)
	m = max(p)
	first = xor == 0 and m > 1 or (xor == 1 and m <= 1)
	print('First' if not first else 'Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	for i in range(n):
		x = x ^ a[i]
	if len(set(a)) == 1 and 1 in a:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')
	t = t - 1


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


from functools import reduce
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
	nimsum = reduce(lambda x, y: x ^ y, arr)
	all1 = all((1 == x for x in arr))
	if nimsum and (not all1) or (not nimsum and all1):
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


for i in range(int(input())):
	A = int(input())
	B = list(map(int, input().split()))
	s = B[0]
	c = 1
	for i in range(1, len(B)):
		s ^= B[i]
	for i in B:
		if i > 1:
			c = 0
	if s == c:
		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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


import sys
n = int(input().strip())
games = []
for _ in range(n):
	npods = int(input().strip())
	pods_start = [int(pod_count) for pod_count in input().strip().split(' ')]
	games.append(pods_start)
for game in games:
	cur = game[0]
	for pos in game[1:]:
		cur = cur ^ pos
	some_big = sum((1 for pos in game if pos > 1))
	if not cur and some_big or (cur and (not some_big)):
		print('Second')
	else:
		print('First')


def winner(n, s):
	x = 0
	for i in s:
		x ^= i
	if len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')
n_test = int(input())
for _ in range(n_test):
	n = int(input())
	s = [int(x) for x in input().split(' ')]
	winner(n, s)


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	s = [int(stemp) for stemp in input().strip().split(' ')]
	score = 0
	for stemp in s:
		score ^= stemp
	if max(s) == 1:
		if len(s) % 2 == 0:
			print('First')
		else:
			print('Second')
	elif score:
		print('First')
	else:
		print('Second')


T = int(input())
for _ in range(T):
	N = int(input())
	V = list(map(int, input().split()))
	nim_sum = 0
	for val in V:
		nim_sum ^= val
	if max(V) == 1:
		print(['First', 'Second'][N % 2])
	else:
		print(['First', 'Second'][nim_sum == 0])


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


g = int(input())
for gi in range(g):
	n = int(input())
	s = [int(s) for s in input().split()]
	nim = 0
	for i in s:
		nim ^= i
	if nim == 0 and sum(s) > n:
		print('Second')
	if nim != 0 and sum(s) > n:
		print('First')
	if sum(s) == n and n % 2 == 0:
		print('First')
	if sum(s) == n and n % 2 != 0:
		print('Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


g = int(input())
for gi in range(g):
	n = int(input())
	a = [int(ai) for ai in input().strip().split(' ')]
	x = a[0]
	stones = a[0]
	for i in range(1, n):
		x = x ^ a[i]
	if len(set(a)) == 1 and 1 in a:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


for _ in range(int(input())):
	input()
	xor = 0
	largest = 0
	for n in (int(x) for x in input().split()):
		xor ^= n
		if n > largest:
			largest = n
	print('Second' if (xor != 0) ^ (largest > 1) else '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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')


output_buffer = list()
from functools import reduce
from operator import xor
T = int(input())
for _ in range(T):
	n = int(input())
	s = list(map(int, input().split()))
	winning = s.count(1) % 2 == 0 if all((ss == 1 for ss in s)) else reduce(xor, s) > 0
	output_buffer.append('First' if winning else 'Second')
print('\n'.join(output_buffer))


from operator import xor
from functools import reduce
for i in range(int(input())):
	input()
	heaps = [int(x) for x in input().split() if x != '0']
	nim_sum = reduce(xor, heaps)
	if all((x == 1 for x in heaps)):
		print('Second' if nim_sum else 'First')
	else:
		print('First' if nim_sum else 'Second')


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 len(set(s)) == 1 and 1 in s:
		if x:
			print('Second')
		else:
			print('First')
	elif x:
		print('First')
	else:
		print('Second')