PP and QQ

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3590
64-bit integer IO format: %I64d      Java class name: Main

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.

Sample Input

2
2
1 2
2
1 2
1
2
1 2

Sample Output

PP
QQ

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .