PP and QQ

TimeLimit: 2000/1000 MS (Java/Others)  MemoryLimit: 32768/32768 K (Java/Others)
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
PP and QQ were playing games at Christmas Eve. They drew some Christmas trees on a paper:



Then they took turns to cut a branch of a tree, and removed the part of the tree which had already not connected with the root. A step shows as follows:



PP always moved first.
PP and QQ took turns (PP was always the first person to move), to cut an edge in the graph, and removed the part of the tree that no longer connected to the root. The person who cannot make a move won the game.
Your job is to decide who will finally win the game if both of them use the best strategy.
Input
The input file contains multiply test cases.
The first line of each test case is an integer N (N<100), which represents the number of sub-trees. The following lines show the structure of the trees. The first line of the description of a tree is the number of the nodes m (m<100). The nodes of a tree are numbered from 1 to m. Each of following lines contains 2 integers a and b representing an edge <a, b>. Node 1 is always the root.
Output
For each test case, output the name of the winner.
SampleInput
2
2
1 2
2
1 2
1
2
1 2
SampleOutput
PP
QQ
Submit
题目统计信息详细
总AC数4
通过人数4
尝试人数5
总提交量6
AC率66.67%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: