2 shunfurh shunfurh 于 2017.08.27 16:13 提问

Ancient Duper

Tewi Inaba (因幡てゐ) is an earthborn rabbit with the ability to bring fortune to those she wishes. Reisen Udongein Inaba (鈴仙・優曇華院・イナバ) is a lunar rabbit with the ability to manipulate wavelength and control madness. Both of them lives in Eientei. Tewi seems to be much of a prankster, and the most common victim is Reisen. She likes to play a game called "AnotherPeg" which is polular in Eientei. The loser of the game will lost her part of mochi. As a natural born duper, she never loses.

Two players play the AnotherPeg game on a r*c board of holes in turn. Some holes are filled with pegs, and some are not. A player may jump a peg over an adjacent peg or several adjacent pegs, as long as the hole the jumping peg lands in is unoccupied. The jumped peg is removed. The player who cannot jump any pegs loses the game.

Input

There are multiple cases. Each case begins with two integers: 1 ≤ r, c ≤ 5. Each of the next r lines consists of c charecters, where 'x' stands for a hole and 'e' stands for a peg. It's guaranteed that no more than 61.8% of them are 'e's. Process to the end of file.

Output

For each test case, output "Tewi first" if Tewi will start the game to make sure she will win, or output "Reisen first" if Tewi will let Reisen start the game.

Sample Input

4 3
xex
exx
xex
xex
5 5
xxexx
xexxe
xxxxx
xxxex
eeexe
5 5
xeeex
xexxe
xxxee
exxxx
exexx
Sample Output

Reisen first
Reisen first
Tewi first

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.10 12:50
已采纳
Csdn user default icon
上传中...
上传图片
插入图片