Jane likes cycles. One day she gets a tree. Jane plans to make some changes on it. She hopes that after adding some edges, its each vertex will only belong to exactly one cycle. Besides, she also hopes that there won’t exist self-loops. Because she thinks the self-loop is not a normal cycle. In order to prevent Jane wasting time on some impossible things, please tell her whether she can finish her plan or not in advance.
There are multiple cases.
For each case, the first line is an integer N (1<=N<=105), indicating Jane’s tree has N vertices. Then following N – 1 Lines. Each line contains two integers Ai,Bi (1<= Ai,Bi<=N), indicating there is an edge between Ai and Bi.
It’s guaranteed that the input data will form a tree.
For each case, output “Possible” if Jane can finish her plan, otherwise output “Impossible”.
7 1 2 1 3 2 4 2 5 3 6 3 7 10 1 2 1 3 2 4 2 5 3 6 3 7 4 8 7 9 7 10
Impossible Possible
In the second case, one way is to add three edges: (5, 6), (4, 8), (9, 10). So that there are three cycles: {1, 2, 3, 5, 6}, {4, 8}, {7, 9, 10}.