James's Birthday Party
InterviewTime limit3sMemory limit1024 MB
Given a friendship graph of up to 100 people, decide whether losing any single friend pair's contact would leave someone uninvited, which means checking for a bridge edge.
Problem

James needs to find out whether he can invite all of his friends to his birthday party. He does not have to invite them all himself. His friends forward invitations to each other.
For example, James has three friends: Lucy, Sue, and Mark. James is friends with all three, but he does not have Mark's phone number, so he cannot invite Mark directly. Sue has Mark's number (and Mark has Sue's), so Sue can invite Mark to the party.
The question is this: if anyone loses one of the phone numbers they have for someone else, would it become impossible to invite everybody? In the example above, if Sue loses Mark's number (the edge shown by the red arrow in the figure), then not everybody can be invited. Assume that if Sue loses Mark's number, Mark also loses Sue's number. Determine whether James is at risk of someone missing the party if any pair of friends loses contact with each other.
Input
The input contains multiple test cases. Each test case starts with a line containing two integers and . Here is the number of people James wants to invite, including himself, and is the number of connections.
,
The next lines each contain two integers and (, , ). This means friend has friend 's phone number and the reverse is also true.
The input ends with a line containing two zeros.
Output
For each test case, print "Yes" if some pair of friends could lose each other's numbers so that not everybody can be invited. Otherwise, print "No".