F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Game!just a game!

Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 194    Accepted Submission(s): 0


Problem Description
This game is played by two persons, who are regarded as the Positive player (P player) and the Negative player (N player). There is a graph G=(V, E ) with P vertexs and Q bidirectional edges between the vertexs. Sometimes there are a lot of edges between two vertexs, and all the edges differ from each other. V1 is the first vertex and Vp is the last vertex.

  Everytime P player marks a ‘+’ on one of the remained edges which have neither a ‘+’ nor ‘-‘ at all, and N player marks a ‘-‘ on that kind of edges without any marks. At the beginning, N player acts first, and then P player does, and then N player does alternately. The game comes to an end when all the edges are marked with either a ‘+’ or a ‘-‘.
  Now we give the rules to judge the winner:
1)  If there exists a road from V1 to Vp, whose edges are all marked with ‘+’, P player wins the game ultimately. So we can see, P player tries his best to create a such road to win the game.
2)  If there exists none such road ,whose edges are all marked with ‘+’ from V1 to Vp, P player losses the game finally. Also we can see, N player does the best to destory that kind of roads described above in rule(1).

Now give you such a graph, you need to verdict the result whether the P player can win the game. If true, print “Yes”, or “No”.
 

Input
There are T cases. In the first line of each case, there are two intergers P and Q, P is the number of the vertexs and Q is the number of the edges. Then there come Q lines,each contains two integers v1(1 – P), and v2 ( 1 – P), indicating one edge between the vertex v1 and v2.
  T<=100,2<=P<=30,1<=Q<=1000.
  There is a blank line to separate the adjacent cases.
 

Output
For each case, print the result “Yes” or “No”.
 

Sample Input
2 2 2 1 2 1 2 4 5 1 2 1 3 2 3 2 4 3 4
 

Sample Output
Yes No
 

Author
wangye
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-11 15:33:54, Gzip enabled