编程介的小学生 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条回答

报告相同问题?

悬赏问题

  • ¥15 如何实验stm32主通道和互补通道独立输出
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题