Under construction

Still being built. Things may change

Xormites

Time limit1sMemory limit256 MB

Summary
Two players take turns removing values from either end of a sequence and XOR them into their own sums. Decide whether the first player wins, the second player wins, or the game is a draw.
Level

Hard8 of 10

Topics
Game theory, Bit manipulation, Dynamic programming
Solved
No attempts yet

Problem

Consider the following two-player game on a sequence of NN integers. The two players move in turns. In each move, the current player selects a value that is either at the beginning or at the end of the sequence, adds it to their own XOR sum, and removes it from the sequence.

This is a well-known game. In this problem, however, the players add the values to a XOR sum instead of a regular sum. Initially, the XOR sums of both players are 00. When adding a new value, the players use the bitwise XOR operation in place of addition.

The game ends when the sequence is empty. The player with the highest XOR sum wins, and the game may also end in a draw. Determine the outcome of the game when both players play optimally.

Input

The first line contains an integer TT, the number of test cases (1≤T≤121 \le T \le 12). Each test case starts with a line containing an integer NN (1≤N≤50 0001 \le N \le 50\,000). The next line contains a sequence of NN positive integers (1≤X≤1091 \le X \le 10^9 for every integer XX in the sequence).

Output

Print TT lines, one per test case. The ii-th line must contain the answer for the ii-th test case. The answer must be one of the following:

  • First if the first player to move wins.
  • Second if the second player to move wins.
  • Draw if the game ends in a draw.

Examples1

  1. Example 1

    Input
    3
    2
    3 3
    2
    3 5
    3
    4 4 4
    
    Expected output
    Draw
    First
    Second