第二回 AtCoder Japan Open -予選- (AtCoder Regular Contest 207 (Div.1))
D
Devourers and Cake
AtCoder
⌀ 2965
原题
← CE →
翻译中…

Problem Statement

翻译中…

Taro the First and Jiro the Second bought a rectangular cake as a present for their mother. They were hungry, so they decided to eat all of the cake except for one piece for their mother.

翻译中…

There is a cake consisting of pieces arranged in $N$ rows and $M$ columns. The piece at the $i$-th row from the top and $j$-th column from the left has a strawberry on it when $s_{i,j}$ is 1, and does not have a strawberry when it is 0.

翻译中…

Starting with Taro the First, the two alternately perform an operation on the cake until only one piece remains. The operations they can perform are as follows. However, they cannot perform an operation that eats all remaining pieces.

翻译中…
  • Eat all pieces in the first row from the top
  • Eat all pieces in the first row from the bottom
  • Eat all pieces in the first column from the left
  • Eat all pieces in the first column from the right
翻译中…

Taro the First wants to leave a piece with a strawberry, and Jiro the Second wants to leave a piece without a strawberry. Determine whether Taro the First can leave a piece with a strawberry no matter how Jiro the Second operates, when Taro operates appropriately.

翻译中…

You are given $T$ test cases; find the answer for each of them.

翻译中…

Constraints

翻译中…
  • $1 \le T \le 10^5$
  • $1 \le N,M \le 10^{3}$
  • $1<NM$
  • $s_{i}$ is a string of length $M$ consisting of 0 and 1.
  • The sum of $NM$ over all test cases is at most $10^6$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

N M
s_1
s_2
\vdots
s_N

翻译中…

Output

翻译中…

Print $T$ lines.

翻译中…

On the $i$-th line, for the $i$-th test case, print First if Taro the First can leave a piece with a strawberry no matter how Jiro the Second operates when Taro operates appropriately, and Second otherwise.

翻译中…

样例

Input #1
4
2 2
01
10
1 4
0100
4 1
0
1
0
0
5 5
00000
11100
01011
00100
01101
Output #1
Second
First
First
Second
For the first test case, no matter what operation Taro performs, Jiro can leave a piece without a strawberry. For the second test case, if Taro operates appropriately, he can leave a piece with a strawberry no matter how Jiro operates. Note that they cannot choose an operation that eats all remaining pieces.
题目信息
题号
arc207_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。