2755Fry and Lisa

2755   Fry and Lisa

题目描述

Fry is playing with his girlfriend Lisa.

  There are so many tree, with some fruits on the top of branches. Fry and Lisa use graph to describe them. Each loop in the graph represent a fruits, each edge which can not from a loop represent a branch. The node with number 1 represent the ground.

  Fry and Lisa play the game in turn, Lisa does the first.

  In one's turn, one can chose a edge which has not been deleted and delete it, after that all edge not connect to ground (not connect to node with number 1) will be deleted too.For example ,there is a tree just like below left picture, if one chose the edge AB, after this turn , the tree will be like below right priture.

                 

  Now you know the graph, please inference who will win the game if both of them play the game cleverly.

  Note you can assue that all of the tree is legal, which you can just understood as:

1. For any loop in the graph, there must be only one node with degree 3, all other node in the loop have degree 2.

2. there is no repeat edge and self - loop.

  For example ,both of below tree is not legal.

输入格式:

  There is a T T<=100at the beginning of input, show that there is T case follow.

  For each case, first line gets two integer n,m, means the number of node and edge. The next m line, each line with two integer a , b , means there is a edge between node a and node b. (1<=n<=100, n-1<=m<=100)

输出格式:

 For each case, output "Case #x: " , x mean the number of case,starting from 1.

  For each game, if Lisa can win the game, output " Stupid Lord!" ,else output "TAT".

输入样例 复制
2
5 5
1 2
2 3
2 4
3 5
4 5
7 6
1 2
2 3
2 4
1 5
5 6
5 7
输出样例 复制
Case #1: Stupid Lord!
Case #2: TAT

说明

For the first sample ,the tree is just like below left picture, as well as the second sample with below right picture.

1
1
通过提交
时空限制1000ms/32mb
题目来源
评测方式在线评测
题目类型
难        度