Decide whether members linked by troublesome pairs split into two groups with no pair inside one group.
Easy3GraphBFSInterviewNo attempts yetTime limit5sMemory limit512 MBBad Horse leads the Evil League of Evil, and he has a lot of problems to deal with. Arguments and backstabbing inside the League have gotten out of hand, so Bad Horse decided to split the League into two departments and keep the troublesome members apart. Being the Thoroughbred of Sin, he is not about to spend his own valuable time working out how to split the members. That is what he has you, his loyal henchman, for.
You are given the list of troublesome pairs. Decide whether every member can be assigned to one of the two departments so that no department contains a troublesome pair. Only the members whose names appear in the input need an assignment.
The first line contains the number of test cases T. T test cases follow.
Each test case starts with a line holding a positive integer M, the number of troublesome pairs of League members. The next M lines each contain a pair of names separated by a single space.
For each test case, print one line of the form Case #x: y, where x is the case number starting from 1, and y is Yes if the members mentioned in the input can be split into two groups with neither group containing a troublesome pair, and No otherwise.