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

2006

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1107    Accepted Submission(s): 329


Problem Description
When the old year is leaving and the New Year is coming, people are always looking back over the past while looking forward to the future.

"What do you think is the most important events in the past year 2006?", a friend asked me.

"Well, maybe the World Cup.", I replied.

"Yeah, do you know, in a football match, how to arrange a proper match table for a group?"

"That's easy. In the World Cup, there are only 4 teams in a group. Everyone knows how to do it."

"Yes, it's easy for four-team¡¯s arrangement. But if there are six teams or more games, can you arrange that?"

"OK, let me have a try". I answered.

In fact, I tried many times to solve the problem, but got failure in the end. Can you help me?
 

Input
The input contains data for several test cases.

Each case contains a single even integer, which is less than 2007, indicate the number of teams in a group.
and n-1 lines followed, indicate the match table.each line indicate one round in the contest.For example,
4
1-2 3-4 // the first round
1-3 2-4 // the second round
1-4 2-3 // the third round
 

Output
For each test case output "Yes" means the match table is correct, or "No" otherwise.
 

Sample Input
2 1-2 4 1-2 3-4 1-3 2-4 1-4 2-3 4 1-3 2-4 1-2 3-4 1-4 2-3 4 1-2 3-2 1-3 2-4 1-4 2-3
 

Sample Output
Yes Yes Yes No
 

Author
xuezaiyue
 

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-16 17:37:19, Gzip enabled