cho.sh
Notes
Loading...

Colored Sticks

Time limit

2s

Memory limit

128 MB

Problem

You are given wooden sticks whose two ends are colored. Determine whether all sticks can be arranged in one straight line so that whenever two stick ends touch, the colors on those two ends are the same. Every stick must be used exactly once.

Input

Input is given until EOF. Each line contains two lowercase English words separated by one space; they are the colors on the two ends of one stick. Each color name has length at most 10. The number of sticks is at most 250,000.

Output

Print Possible if all sticks can be arranged in one valid line. Otherwise, print Impossible.