Two players are playing a game on a $15\times15$ chessboard. The rules of the game are as follows:

The game starts with $\boldsymbol{\mbox{k}}$ coins located at one or more $(x,y)$ coordinates on the board (a single cell may contain more than one coin). The coordinate of the upper left cell is $(1,1)$, and the coordinate of the lower right cell is $(15,15)$.

In each move, a player must move a single coin from some cell $(x,y)$ to one of the following locations:

$(x-2,y+1)$ 
$(x-2,y-1)$ 
$(x+1,y-2)$ 
$(x-1,y-2)$. 

Note: The coin must remain inside the confines of the board.

The players move in alternating turns. The first player who is unable to make a move loses the game.

The figure below shows all four possible moves:

Note: While the figure shows a $8\times8$ board, this game is played on a $15\times15$ board.

Given the value of $\boldsymbol{\mbox{k}}$ and the initial coordinate(s) of $\boldsymbol{\mbox{k}}$ coins, determine which player will win the game. Assume both players always move optimally.

Input Format

The first line contains an integer, $\mathbf{T}$, denoting the number of test cases. 

Each test case is defined as follows over the subsequent lines:

The first line contains an integer, $\boldsymbol{\mbox{k}}$, denoting the number of coins on the board.
Each line $\boldsymbol{i}$ (where $0\leq i<k$) of the $\boldsymbol{\mbox{k}}$ subsequent lines contains $2$ space-separated integers describing the respective values of $x_i$ and $y_i$ of the coordinate where coin $k_i$ is located.

Note: Recall that a cell can have more than one coin (i.e., any cell can have $0$ to $\boldsymbol{\mbox{k}}$ coins in it at any given time).

Constraints

$1\leq T\leq1000$
$1\leq k\leq1000$
$1\leq x_i,y_i\leq15$, where $0\leq i<k$.

Output Format

On a new line for each test case, print $\textbf{First}$ if the first player is the winner; otherwise, print $\textbf{Second}$.

Sample Input
2
3
5 4
5 8
8 2
6
7 1
7 2
7 3
7 4
7 4
7 4

Sample Output
First
Second

Source: hackerrank | Difficulty: MEDIUM
Tags: Game theory


Solutions:
grundy = [[-1] * 15 for _ in range(15)]
grundy[0][0] = grundy[0][1] = grundy[1][0] = grundy[1][1] = 0

def moveCoin(x, y):
	if x > 1:
		if y > 0:
			yield (x - 2, y - 1)
		if y < 14:
			yield (x - 2, y + 1)
	if y > 1:
		if x > 0:
			yield (x - 1, y - 2)
		if x < 14:
			yield (x + 1, y - 2)

def getGrundy(x, y):
	if grundy[x][y] != -1:
		return grundy[x][y]
	s = set()
	for (i, j) in moveCoin(x, y):
		s.add(getGrundy(i, j))
	mex = 0
	while mex in s:
		mex += 1
	grundy[x][y] = mex
	return mex
for _ in range(int(input())):
	k = int(input())
	coins = [[0] * 15 for _ in range(15)]
	for _ in range(k):
		(i, j) = [int(x) - 1 for x in input().split(' ')]
		coins[i][j] = 1 - coins[i][j]
	res = 0
	for i in range(15):
		for j in range(15):
			if coins[i][j]:
				res ^= getGrundy(i, j)
	print('First' if res else 'Second')


dic = {}

def grundy(x, y):
	if x < 1 or y < 1 or x > 15 or (y > 15):
		return -1
	if (x, y) in dic:
		return dic[x, y]
	s = []
	s.append(grundy(x - 1, y - 2))
	s.append(grundy(x + 1, y - 2))
	s.append(grundy(x - 2, y + 1))
	s.append(grundy(x - 2, y - 1))
	i = 0
	while True:
		if i not in s:
			dic[x, y] = i
			return i
		i = i + 1
t = int(input())
for _ in range(t):
	k = int(input())
	a = []
	v = 0
	for i in range(k):
		(x, y) = map(int, input().split())
		v = v ^ grundy(x, y)
	if v:
		print('First')
	else:
		print('Second')


grun = {}

def grundy(x, y):
	if 0 < x < 16 > y > 0:
		if (x, y) not in grun:
			a = {grundy(x - 2, y - 1), grundy(x - 2, y + 1), grundy(x - 1, y - 2), grundy(x + 1, y - 2)}
			k = 0
			while k in a:
				k += 1
			grun[x, y] = k
		return grun[x, y]
	return -1
for _ in range(int(input())):
	k = 0
	for _ in range(int(input())):
		k ^= grundy(*map(int, input().split()))
	print('First' if k else 'Second')


from sys import stdin

def read_ints():
	return [int(a.strip()) for a in stdin.readline().strip().split(' ')]
board = [[-1 for _ in range(15)] for _ in range(15)]
board[0][0] = 0
moves = [(-1, -2), (-2, -1), (-2, 1), (1, -2)]

def add(a, b):
	return (a[0] + b[0], a[1] + b[1])

def is_valid(p):
	return p[0] >= 0 and p[1] >= 0 and (p[0] < 15) and (p[1] < 15)

def nimber(p):
	b = board[p[0]][p[1]]
	if b != -1:
		return b
	fields = [add(p, a) for a in moves]
	nimbs = {nimber(a): True for a in fields if is_valid(a)}
	b = 0
	while b in nimbs:
		b += 1
	board[p[0]][p[1]] = b
	return b
for _ in range(read_ints()[0]):
	r = 0
	for _ in range(read_ints()[0]):
		field = add((-1, -1), read_ints())
		r ^= nimber(field)
	print('First' if r else 'Second')


from functools import reduce
from itertools import chain
from operator import xor
board = [[-1] * 19 for _ in range(19)]
size = 15

def mex(*numbers):
	return next((i for i in range(size) if i not in numbers))
stripes = chain(chain.from_iterable((zip(range(s + 1), reversed(range(s + 1))) for s in range(size))), chain.from_iterable((zip(range(s, size), reversed(range(s, size))) for s in range(1, size))))
for (i, j) in stripes:
	board[i + 2][j + 2] = mex(board[i][j + 3], board[i][j + 1], board[i + 1][j], board[i + 3][j])
for _ in range(int(input().strip())):
	coins = [[int(x) for x in input().strip().split(' ')] for _ in range(int(input().strip()))]
	print('First' if reduce(xor, (board[x + 1][y + 1] for (x, y) in coins), 0) else 'Second')


def mex(S):
	i = 0
	while i in S:
		i += 1
	return i

def sg_chess(x, y, max_x=15, max_y=15, cache={}):
	key = (x, y)
	S = set()
	if key in cache:
		return cache[key]
	for (delta_x, delta_y) in [(-2, 1), (-2, -1), (1, -2), (-1, -2)]:
		(new_x, new_y) = (x + delta_x, y + delta_y)
		if 1 <= new_x <= max_x and 1 <= new_y <= max_y:
			S.add(sg_chess(new_x, new_y))
	cache[key] = mex(S)
	return cache[key]
for t in range(int(input())):
	k = int(input())
	positions = [tuple(map(int, input().split())) for i in range(k)]
	nim_sum = 0
	for (x, y) in positions:
		nim_sum ^= sg_chess(x, y)
	print(['Second', 'First'][nim_sum > 0])


from functools import reduce
t = int(input())
MAX = 15
grundy = [[0 for x in range(15)] for y in range(15)]
moves = [(-2, -1), (-2, 1), (-1, -2), (1, -2)]

def mex(s):
	m = max(s)
	for i in range(m):
		if i not in s:
			return i
	return m + 1

def in_bound(x, y):
	return x >= 0 and x < MAX and (y >= 0) and (y < MAX)
for i in range(2 * MAX - 1):
	for j in range(i + 1):
		if not in_bound(i - j, j):
			continue
		if i - j <= 1 and j <= 1:
			grundy[i - j][j] = 0
		else:
			s = set()
			for (x, y) in moves:
				if in_bound(i - j + x, j + y):
					s.add(grundy[i - j + x][j + y])
			grundy[i - j][j] = mex(s)
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		l.append([int(k) for k in input().split()])
	l = [grundy[i - 1][j - 1] for (i, j) in l]
	temp = reduce(lambda x, y: x ^ y, l)
	if temp == 0:
		print('Second')
	else:
		print('First')


from functools import reduce
S = 15
z = [[0 for _ in range(S)] for _ in range(S)]

def h(x, y, a, b):
	k = x + a
	l = y + b
	return z[k][l] if k >= 0 and l >= 0 and (k < S) and (l < S) else 5
for xy in range(S * S):
	for x in range(S):
		y = xy - x
		if y >= 0 and y < S:
			p = [h(x, y, -2, -1), h(x, y, -2, 1), h(x, y, -1, -2), h(x, y, 1, -2)]
			p.sort()
			t = 0
			for f in p:
				if f == t:
					t += 1
			z[x][y] = t
for _ in range(int(input())):
	w = reduce(lambda a, b: a ^ b, (z[g][h] for (g, h) in ((int(x) - 1 for x in input().strip().split()) for _ in range(int(input())))))
	print('First' if w != 0 else 'Second')


import sys
dic = {}

def call(x, y):
	if x < 1 or y < 1 or x > 15 or (y > 15):
		return -1
	if (x, y) in dic:
		return dic[x, y]
	s = []
	s.append(call(x - 1, y - 2))
	s.append(call(x + 1, y - 2))
	s.append(call(x - 2, y + 1))
	s.append(call(x - 2, y - 1))
	i = 0
	while True:
		if i not in s:
			dic[x, y] = i
			return i
		i = i + 1
t = int(input())
a = []
for _ in range(t):
	k = int(input())
	xorsum = 0
	for _ in range(k):
		(x, y) = map(int, input().split())
		xorsum = xorsum ^ call(x, y)
	if xorsum:
		a.append('First')
	else:
		a.append('Second')
for i in range(len(a)):
	print(a[i])


from functools import reduce
from operator import xor
gnum = [[-1] * 17 for _ in range(17)]
for s in range(2, 31):
	for j in range(max(1, s - 15), min(16, s)):
		i = s - j
		target = ((i - 1, j - 2), (i + 1, j - 2), (i - 2, j - 1), (i - 2, j + 1))
		nextval = {gnum[x][y] for (x, y) in target}
		gnum[i][j] = next((i for i in range(100) if i not in nextval))
for _ in range(int(input())):
	print('First' if reduce(xor, (gnum[x][y] for (x, y) in (map(int, input().split()) for _ in range(int(input())))), 0) else 'Second')


memo = dict()
moves = [(-2, 1), (-2, -1), (1, -2), (-1, -2)]

def mex(values):
	max_val = max(values)
	return min(frozenset(range(max_val + 2)).difference(values))

def grundy(x, y):
	if x <= 0 or y <= 0 or x > 15 or (y > 15):
		return 10000
	key = (x, y)
	if key not in memo:
		memo[key] = mex([grundy(x + dx, y + dy) for (dx, dy) in moves])
	return memo[key]
t = int(input())
for _ in range(t):
	n = int(input())
	tokens = []
	for _ in range(n):
		tokens.append(tuple(map(int, input().split())))
	result = 0
	for (x, y) in tokens:
		result ^= grundy(x, y)
	print('First' if result > 0 else 'Second')


mp = []
for i in range(15):
	mp.append([-1] * 15)
dir = [[-2, 1], [-2, -1], [1, -2], [-1, -2]]

def dfs(x, y):
	if mp[x][y] != -1:
		return mp[x][y]
	f = [False] * 101
	for i in range(4):
		ex = x + dir[i][0]
		ey = y + dir[i][1]
		if ex < 0 or ey < 0 or ex >= 15 or (ey >= 15):
			continue
		f[dfs(ex, ey)] = True
	for i in range(101):
		if not f[i]:
			break
	mp[x][y] = i
	return i
for _ in range(int(input().strip())):
	s = 0
	for i in range(int(input().strip())):
		[x, y] = map(int, input().strip().split())
		s ^= dfs(x - 1, y - 1)
	if s == 0:
		print('Second')
	else:
		print('First')


def setGrundy(matrix, x, y):
	s = set()
	if inBoard(x - 2, y - 1):
		s.add(matrix[x - 2][y - 1])
	if inBoard(x - 2, y + 1):
		s.add(matrix[x - 2][y + 1])
	if inBoard(x - 1, y - 2):
		s.add(matrix[x - 1][y - 2])
	if inBoard(x + 1, y - 2):
		s.add(matrix[x + 1][y - 2])
	ret = 0
	while ret in s:
		ret += 1
	matrix[x][y] = ret

def inBoard(x, y):
	return x >= 1 and y >= 1 and (x <= 15) and (y <= 15)

def populate(matrix):
	n = len(matrix) - 1
	for i in range(2, n + 2):
		for j in range(1, i):
			setGrundy(matrix, j, i - j)
	for i in range(n + 2, 2 * n + 1):
		for j in range(i - n, n + 1):
			setGrundy(matrix, j, i - j)
grundyMatrix = [[0] * 16 for _ in range(16)]
populate(grundyMatrix)
T = int(input())
for _ in range(T):
	k = int(input())
	res = 0
	for i in range(k):
		(x, y) = map(int, input().split())
		res ^= grundyMatrix[x][y]
	print('Second' if res == 0 else 'First')


from operator import xor
from functools import lru_cache, reduce
SIZE = 15
MOVES = ((1, -2), (-1, -2), (-2, -1), (-2, 1))

def mex(it):
	s = set(it)
	for i in range(len(s) + 1):
		if i not in s:
			return i

def on_board(y, x):
	return 0 <= y < SIZE and 0 <= x < SIZE

@lru_cache(None)
def grundy(y, x):
	targets = ((y + dy, x + dx) for (dy, dx) in MOVES)
	return mex((grundy(ty, tx) for (ty, tx) in targets if on_board(ty, tx)))
for _ in range(int(input())):
	coords = ((int(x) - 1 for x in input().split()) for _ in range(int(input())))
	print('First' if reduce(xor, (grundy(y, x) for (x, y) in coords)) else 'Second')


def findGrundy(x, y, n, array):
	res = 0
	tmpArray = []
	if x > 1:
		if y > 0:
			tmpArray.append(array[x - 2][y - 1])
		if y < n - 1:
			tmpArray.append(array[x - 2][y + 1])
	if y > 1:
		if x > 0:
			tmpArray.append(array[x - 1][y - 2])
		if x < n - 1:
			tmpArray.append(array[x + 1][y - 2])
	while res in tmpArray:
		res += 1
	return res

def buildBoard(n):
	array = []
	for k in range(2 * n - 1):
		if k < n:
			array.append([])
			for i in range(k + 1):
				tmp = findGrundy(i, k - i, n, array)
				array[i].append(tmp)
		else:
			for i in range(k + 1 - n, n):
				tmp = findGrundy(i, k - i, n, array)
				array[i].append(tmp)
	return array
T = int(input().strip())
for i in range(T):
	k = int(input().strip())
	res = 0
	array = buildBoard(15)
	for j in range(k):
		pos = [int(x) for x in input().split()]
		grundy = array[pos[0] - 1][pos[1] - 1]
		res ^= grundy
	if res == 0:
		print('Second')
	else:
		print('First')


board = {}
moves = [(-1, -2), (+1, -2), (-2, -1), (-2, +1)]

def calc_moves(n, m):
	if n < 1 or n > 15 or m < 1 or (m > 15):
		return -1
	elif (n, m) in board:
		return board[n, m]
	score = []
	for move in moves:
		score.append(calc_moves(n + move[0], m + move[1]))
	board[n, m] = mex(score)
	return board[n, m]

def mex(s):
	i = 0
	while True:
		if i not in s:
			return i
		i += 1

def print_board(board):
	for j in range(1, 16):
		for i in range(1, 16):
			if (i, j) not in board:
				calc_moves(i, j)
		print('{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14}'.format(board[1, j], board[2, j], board[3, j], board[4, j], board[5, j], board[6, j], board[7, j], board[8, j], board[9, j], board[10, j], board[11, j], board[12, j], board[13, j], board[14, j], board[15, j]))
T = int(input().strip())
for i in range(T):
	k = int(input().strip())
	score = 0
	for j in range(k):
		(n, m) = [int(temp) for temp in input().strip().split(' ')]
		score ^= calc_moves(n, m)
	if score == 0:
		print('Second')
	else:
		print('First')


board = [[-1] * 15 for i in range(15)]
pool = [(i, j) for i in range(15) for j in range(15)]
for i in range(2):
	for j in range(2):
		board[i][j] = 0
		pool.remove((i, j))
while pool:
	for (x, y) in list(pool):
		others = set()
		for (p, q) in [(x - 2, y - 1), (x - 2, y + 1), (x - 1, y - 2), (x + 1, y - 2)]:
			if 0 <= p < 15 and 0 <= q < 15:
				others.add(board[p][q])
		if -1 not in others:
			for t in range(max(others) + 2):
				if t not in others:
					board[x][y] = t
					pool.remove((x, y))
					break
			break
for t in range(int(input().strip())):
	nim = 0
	for k in range(int(input().strip())):
		(x, y) = map(lambda t: int(t) - 1, input().strip().split())
		nim ^= board[x][y]
	print('First' if nim > 0 else 'Second')


def chess(x, y):
	if 0 <= x < 15 > y >= 0:
		if G[x][y] == -1:
			s = {chess(x - 2, y + 1), chess(x - 2, y - 1), chess(x - 1, y - 2), chess(x + 1, y - 2)}
			i = 0
			while i in s:
				i += 1
			G[x][y] = i
		return G[x][y]
	return -1
G = [[-1] * 15 for i in range(15)]
for i in range(2):
	for j in range(2):
		G[i][j] = 0
for i in range(15):
	for j in range(15):
		G[i][j] = chess(i, j)
for i in range(int(input())):
	ans = 0
	for j in range(int(input())):
		(x, y) = map(int, input().split())
		ans ^= G[x - 1][y - 1]
	if ans == 0:
		print('Second')
	else:
		print('First')


from collections import defaultdict
from functools import lru_cache
from functools import reduce
from operator import xor
dy = [-2, -2, 1, -1]
dx = [1, -1, -2, -2]

def inside(y: int, x: int, H: int, W: int) -> bool:
	return 1 <= y <= H and 1 <= x <= W

@lru_cache(10000)
def grundy(y, x):
	if not inside(y, x, 15, 15):
		return -1
	s = set((grundy(x + dx[i], y + dy[i]) for i in range(4)))
	res = 0
	while res in s:
		res += 1
	return res

def main():
	T = int(input())
	for i in range(T):
		k = int(input())
		grundy_list = []
		for j in range(k):
			(x, y) = map(int, input().split())
			grundy_list.append(grundy(y, x))
		print('First' if reduce(xor, grundy_list) != 0 else 'Second')
main()


visited = [[0 for i in range(15)] for i in range(15)]
grundy = [[0 for i in range(15)] for i in range(15)]

def find_grundy(i, j):
	if i < 0 or j < 0 or i >= 15 or (j >= 15):
		return None
	if visited[i][j]:
		return grundy[i][j]
	visited[i][j] = 1
	s = set()
	if find_grundy(i - 2, j + 1) != None:
		s.add(find_grundy(i - 2, j + 1))
	if find_grundy(i - 2, j - 1) != None:
		s.add(find_grundy(i - 2, j - 1))
	if find_grundy(i + 1, j - 2) != None:
		s.add(find_grundy(i + 1, j - 2))
	if find_grundy(i - 1, j - 2) != None:
		s.add(find_grundy(i - 1, j - 2))
	m = 0
	while m in s:
		m += 1
	grundy[i][j] = m
	return m
for t in range(int(input())):
	coins = []
	for k in range(int(input())):
		coins.append(map(lambda x: int(x) - 1, input().split()))
	total = 0
	for c in coins:
		total ^= find_grundy(*c)
	print('First' if total else 'Second')


M = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 3, 2, 1], [0, 1, 1, 2, 1, 4, 3, 2, 3, 3, 3, 2, 3, 3, 3, 1], [0, 0, 0, 3, 4, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 2, 3, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1], [0, 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 3, 2, 1], [0, 1, 1, 2, 3, 1, 1, 2, 1, 4, 3, 2, 3, 3, 3, 1], [0, 0, 0, 3, 3, 0, 0, 3, 4, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 2, 3, 0, 0, 2, 3, 0, 0, 2, 1, 0, 0, 1], [0, 1, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 3, 2, 1], [0, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 1, 4, 3, 1], [0, 0, 0, 3, 3, 0, 0, 3, 3, 0, 0, 3, 4, 0, 0, 1], [0, 0, 0, 2, 3, 0, 0, 2, 3, 0, 0, 2, 3, 0, 0, 2], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1]]
n = int(input().strip())
for i in range(n):
	k = int(input().strip())
	x = 0
	for j in range(k):
		(r, c) = [int(x) for x in input().split()]
		x ^= M[r][c]
	print('Second' if x == 0 else 'First')


MOVES = [[-2, 1], [-2, -1], [-1, -2], [1, -2]]

def inrange(x, y):
	if x >= 0 and x < 15 and (y >= 0) and (y < 15):
		return True
	return False

def checkPosition(c_b, x, y, MOVES):
	s = set()
	for moves in MOVES:
		curr_x = x + moves[0]
		curr_y = y + moves[1]
		if inrange(curr_x, curr_y):
			s.add(c_b[curr_x][curr_y])
			if c_b[curr_x][curr_y] == -1:
				print('encountered -1')
	res = 0
	while res in s:
		res += 1
	return res
CHESS_BOARD = [[-1] * 15 for _ in range(15)]
MOVES = [[-2, 1], [-2, -1], [-1, -2], [1, -2]]
y = 0
while y <= 14:
	y_temp = y
	x = 0
	while y_temp > -1:
		CHESS_BOARD[x][y_temp] = checkPosition(CHESS_BOARD, x, y_temp, MOVES)
		x += 1
		y_temp -= 1
	y += 1
x = 1
while x <= 14:
	x_temp = x
	y = 14
	while x_temp < 15:
		CHESS_BOARD[x_temp][y] = checkPosition(CHESS_BOARD, x_temp, y, MOVES)
		x_temp += 1
		y -= 1
	x += 1
for _ in range(int(input().strip())):
	res = 0
	for k in range(int(input().strip())):
		(x, y) = map(int, input().strip().split())
		x -= 1
		y -= 1
		res ^= CHESS_BOARD[x][y]
	if res == 0:
		print('Second')
	else:
		print('First')


def parseInput(f):
	return [f(x) for x in input().split()]
memo = {}
dirs = [(-2, 1), (-2, -1), (1, -2), (-1, -2)]

def check(x, y):
	return 1 <= x <= 15 and 1 <= y <= 15

def grundy(x, y):
	if (x, y) in memo:
		return memo[x, y]
	mex = set()
	for (dx, dy) in dirs:
		(nx, ny) = (x + dx, y + dy)
		if check(nx, ny):
			mex.add(grundy(nx, ny))
	answer = 0
	while answer in mex:
		answer += 1
	memo[x, y] = answer
	return answer
t = int(input())
for _ in range(t):
	n = int(input())
	answer = 0
	for i in range(n):
		(x, y) = parseInput(int)
		answer ^= grundy(x, y)
	print('First' if answer else 'Second')


cache = [[0] * 16 for x in range(16)]
move = [(-2, 1), (-2, -1), (1, -2), (-1, -2)]
c = 0
for z in range(1, 17):
	for x in range(1, z):
		y = z - x
		fs = [False] * 17
		for m in move:
			if x + m[0] > 0 and x + m[0] < 16 and (y + m[1] > 0) and (y + m[1] < 16):
				fs[cache[x + m[0]][y + m[1]]] = True
		mv = 0
		while fs[mv]:
			mv += 1
		cache[x][y] = mv
for z in range(15, 1, -1):
	for i in range(1, z):
		x = 16 - i
		y = 16 - z + i
		fs = [False] * 17
		for m in move:
			if x + m[0] > 0 and x + m[0] < 16 and (y + m[1] > 0) and (y + m[1] < 16):
				fs[cache[x + m[0]][y + m[1]]] = True
		mv = 0
		while fs[mv]:
			mv += 1
		cache[x][y] = mv

def getMex(x, y):
	return cache[x][y]
import functools
for _ in range(int(input())):
	xs = 0
	for s in range(int(input())):
		xs ^= getMex(*map(int, input().split(' ')))
	print('First' if xs else 'Second')


import sys
from time import time
cache = dict()

def nimber(coord):
	if coord in cache:
		return cache[coord]
	nn = set()
	for (dr, dc) in ((-2, 1), (-2, -1), (1, -2), (-1, -2)):
		(r, c) = (coord[0] + dr, coord[1] + dc)
		if not (r < 1 or r > 15 or c < 1 or (c > 15)):
			nn.add(nimber((r, c)))
	rval = 0
	while rval in nn:
		rval += 1
	cache[coord] = rval
	return rval

def solve(bb):
	rval = 0
	for coord in bb:
		rval ^= nimber(coord)
	return rval > 0
tm = time()
t = int(input())
for _ in range(t):
	n = int(input())
	bb = []
	for _ in range(n):
		(r, c) = map(int, input().split())
		bb.append((r, c))
	if solve(bb):
		print('First')
	else:
		print('Second')
print('time elapsed: %s' % (time() - tm,), file=sys.stderr)


nimber = [[0] * 15 for _ in range(15)]
for s in range(29):
	for i in range(max(0, s - 14), min(14, s) + 1):
		j = s - i
		ex = set(range(5))
		for (di, dj) in [(-2, 1), (-2, -1), (1, -2), (-1, -2)]:
			if 0 <= i + di < 15 and 0 <= j + dj < 15:
				ex.discard(nimber[i + di][j + dj])
		nimber[i][j] = min(ex)
for _ in range(int(input())):
	nimsum = 0
	for _ in range(int(input())):
		(x, y) = map(int, input().split())
		nimsum ^= nimber[x - 1][y - 1]
	print(['First', 'Second'][nimsum == 0])


N = 15
g = [[0] * N for i in range(N)]

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

def options(i, j):
	ddi = [1, -1, -2, -2]
	ddj = [-2, -2, 1, -1]
	for (di, dj) in zip(ddi, ddj):
		ni = i + di
		nj = j + dj
		if ni >= 0 and ni < N and (nj >= 0) and (nj < N):
			yield g[ni][nj]

def work(i, j):
	g[i][j] = mex(options(i, j))

def work_diag(i, j):
	if i < 0 or j >= N:
		return
	work(i, j)
	work_diag(i - 1, j + 1)
for i in range(N):
	work_diag(i, 0)
for j in range(1, N):
	work_diag(N - 1, j)
for _ in range(int(input())):
	C = int(input())
	xor = 0
	for _ in range(C):
		(x, y) = map(int, input().split())
		x -= 1
		y -= 1
		xor ^= g[x][y]
	if xor:
		print('First')
	else:
		print('Second')


from functools import lru_cache

def mex(X):
	x = 0
	while x in X:
		x += 1
	return x
S = 15

@lru_cache(maxsize=None)
def grundy(x, y):
	if x == y == 0:
		return 0
	X = []
	for (vx, vy) in ((x - 2, y + 1), (x - 2, y - 1), (x + 1, y - 2), (x - 1, y - 2)):
		if 0 <= vx < S and 0 <= vy < S:
			X.append(grundy(vx, vy))
	return mex(X)

def main():
	T = int(input())
	for _ in range(T):
		K = int(input())
		G = 0
		for _ in range(K):
			(x, y) = map(int, input().split())
			G ^= grundy(x - 1, y - 1)
		print('First' if G != 0 else 'Second')
main()


grun = {}

def grundy(x, y):
	if 0 < x < 16 > y > 0:
		if (x, y) not in grun:
			a = {grundy(x - 2, y - 1), grundy(x - 2, y + 1), grundy(x - 1, y - 2), grundy(x + 1, y - 2)}
			k = 0
			while k in a:
				k += 1
			grun[x, y] = k
		return grun[x, y]
	return -1
for _ in range(int(input())):
	k = 0
	for _ in range(int(input())):
		k ^= grundy(*map(int, input().split()))
	print('First' if k else 'Second')


def setGrundy(matrix, x, y):
	s = set()
	if inBoard(x - 2, y - 1):
		s.add(matrix[x - 2][y - 1])
	if inBoard(x - 2, y + 1):
		s.add(matrix[x - 2][y + 1])
	if inBoard(x - 1, y - 2):
		s.add(matrix[x - 1][y - 2])
	if inBoard(x + 1, y - 2):
		s.add(matrix[x + 1][y - 2])
	ret = 0
	while ret in s:
		ret += 1
	matrix[x][y] = ret

def inBoard(x, y):
	return x >= 1 and y >= 1 and (x <= 15) and (y <= 15)

def populate(matrix):
	n = len(matrix) - 1
	for i in range(2, n + 2):
		for j in range(1, i):
			setGrundy(matrix, j, i - j)
	for i in range(n + 2, 2 * n + 1):
		for j in range(i - n, n + 1):
			setGrundy(matrix, j, i - j)
grundyMatrix = [[0] * 16 for _ in range(16)]
populate(grundyMatrix)
T = int(input())
for _ in range(T):
	k = int(input())
	res = 0
	for i in range(k):
		(x, y) = map(int, input().split())
		res ^= grundyMatrix[x][y]
	print('Second' if res == 0 else 'First')


import sys
dic = {}

def call(x, y):
	if x < 1 or y < 1 or x > 15 or (y > 15):
		return -1
	if (x, y) in dic:
		return dic[x, y]
	s = []
	s.append(call(x - 1, y - 2))
	s.append(call(x + 1, y - 2))
	s.append(call(x - 2, y + 1))
	s.append(call(x - 2, y - 1))
	i = 0
	while True:
		if i not in s:
			dic[x, y] = i
			return i
		i = i + 1
t = int(input())
a = []
for _ in range(t):
	k = int(input())
	xorsum = 0
	for _ in range(k):
		(x, y) = map(int, input().split())
		xorsum = xorsum ^ call(x, y)
	if xorsum:
		a.append('First')
	else:
		a.append('Second')
for i in range(len(a)):
	print(a[i])


value = list()
for i in range(17):
	value.append([None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None])

def chess(a, b):
	if (a == 2 or a == 1) and (b == 1 or b == 2):
		return 0
	if value[a][b] != None:
		return value[a][b]
	lis = [[-1, -2], [1, -2], [-2, -1], [-2, 1]]
	poi = list()
	for i in range(4):
		e = a + lis[i][0]
		d = b + lis[i][1]
		if (e > 0 and e < 16) and (d > 0 and d < 16):
			poi.append(chess(e, d))
	mex = 0
	while True:
		if poi.count(mex) == 0:
			break
		mex += 1
	value[a][b] = mex
	return mex
result = list()
for i in range(int(input())):
	g = 0
	for j in range(int(input())):
		ar = list(map(int, input().split()))
		g ^= chess(ar[0], ar[1])
	if g == 0:
		result.append('Second')
	else:
		result.append('First')
print('\n'.join(result))


import math
import os
import random
import re
import sys
dic = {}

def grundy(x, y):
	if x < 1 or y < 1 or x > 15 or (y > 15):
		return -1
	if (x, y) in dic:
		return dic[x, y]
	s = []
	s.append(grundy(x - 1, y - 2))
	s.append(grundy(x + 1, y - 2))
	s.append(grundy(x - 2, y + 1))
	s.append(grundy(x - 2, y - 1))
	i = 0
	while True:
		if i not in s:
			dic[x, y] = i
			return i
		i = i + 1
t = int(input())
for _ in range(t):
	k = int(input())
	a = []
	v = 0
	for i in range(k):
		(x, y) = map(int, input().split())
		v = v ^ grundy(x, y)
	if v:
		print('First')
	else:
		print('Second')


grundy = [[-1] * 15 for _ in range(15)]
grundy[0][0] = grundy[0][1] = grundy[1][0] = grundy[1][1] = 0

def moveCoin(x, y):
	if x > 1:
		if y > 0:
			yield (x - 2, y - 1)
		if y < 14:
			yield (x - 2, y + 1)
	if y > 1:
		if x > 0:
			yield (x - 1, y - 2)
		if x < 14:
			yield (x + 1, y - 2)

def getGrundy(x, y):
	if grundy[x][y] != -1:
		return grundy[x][y]
	s = set()
	for (i, j) in moveCoin(x, y):
		s.add(getGrundy(i, j))
	mex = 0
	while mex in s:
		mex += 1
	grundy[x][y] = mex
	return mex
for _ in range(int(input())):
	k = int(input())
	coins = [[0] * 15 for _ in range(15)]
	for _ in range(k):
		(i, j) = [int(x) - 1 for x in input().split(' ')]
		coins[i][j] = 1 - coins[i][j]
	res = 0
	for i in range(15):
		for j in range(15):
			if coins[i][j]:
				res ^= getGrundy(i, j)
	print('First' if res else 'Second')