Preparing NOJ

# PP and QQ

1000ms 32768K

## 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

Info

Provider HDU

Code HDU3590

Tags

Submitted 22

Passed 14

AC Rate 63.64%

Date 06/03/2019 16:36:50

Related

Nothing Yet