NECプログラミングコンテスト2021(AtCoder Beginner Contest 229)
H
Advance or Eat
AtCoder
⌀ 3308
原题
← G→
翻译中…

Problem Statement

翻译中…

There is a grid with $N$ rows and $N$ columns, where each square has one white piece, one black piece, or nothing on it. The square at the $i$-th row from the top and $j$-th column from the left is described by $S_{i,j}$. If $S_{i,j}$ is W, the square has a white piece; if $S_{i,j}$ is B, it has a black piece; if $S_{i,j}$ is ., it is empty.

翻译中…

Takahashi and Snuke will play a game, where the players take alternate turns, with Takahashi going first.

翻译中…

In Takahashi's turn, he does one of the following operations.

翻译中…
  • Choose a white piece that can move one square up to an empty square, and move it one square up (see below).
  • Eat a black piece of his choice.
翻译中…

In Snuke's turn, he does one of the following operations.

翻译中…
  • Choose a black piece that can move one square up to an empty square, and move it one square up.
  • Eat a white piece of his choice.
翻译中…

The player who becomes unable to do the operation loses the game. Which player will win when both players play optimally?

翻译中…

Here, moving a piece one square up means moving a piece at the $i$-th row and $j$-th column to the $(i-1)$-th row and $j$-th column. Note that this is the same for both players; they see the board from the same direction.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 8$
  • $N$ is an integer.
  • $S_{i,j}$ is W, B, or ..
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
S_{1,1}S_{1,2}\ldots S_{1,N}
S_{2,1}S_{2,2}\ldots S_{2,N}
\vdots
S_{N,1}S_{N,2}\ldots S_{N,N}

翻译中…

Output

翻译中…

If Takahashi will win, print Takahashi; if Snuke will win, print Snuke.

翻译中…

样例

Input #1
3
BB.
.B.
...
Output #1
Takahashi
If Takahashi eats the black piece at the $1$-st row and $1$-st columns, the board will become: Then, Snuke cannot do an operation, making Takahashi win. Note that it is forbidden to move a piece out of the board or to a square occupied by another piece.
Input #2
2
..
WW
Output #2
Snuke
Input #3
4
WWBW
WWWW
BWB.
BBBB
Output #3
Snuke
题目信息
题号
abc229_h
时间限制
2 s
内存限制
1024 MB

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