编程介的小学生 2017-08-27 08:13 采纳率: 20.5%
浏览 866
已采纳

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条回答

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站