1618: Colored Sticks
内存限制:128 MB
时间限制:5.000 S
评测方式:文本比较
命题人:
提交:7
解决:2
题目描述
You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are of the same color?
输入
Input is a sequence of lines, each line contains two words, separated by spaces, giving the colors of the endpoints of one stick. A word is a sequence of lowercase letters no longer than 10 characters. There is no more than 250000 sticks.
输出
If the sticks can be aligned in the desired way, output a single line saying Possible, otherwise output Impossible.
样例输入 复制
blue red
red violet
cyan blue
blue magenta
magenta cyan
样例输出 复制
Possible
提示
Huge input,scanf is recommended.