172. eXam
time limit per test: 0.25
sec.
memory limit per test: 4096
KB
input: standard
output: standard
In Russia school pupils must do some exams before leaving school. Among others, they must do two "selective" exams. This means that school provides a list of available subjects; each pupil selects two different subjects from this list and is going to do this exams. According to rules, pupil isn't allowed to do both exams at the same day, so the school must schedule the exams, i.e. provide some days when pupils will be able to do exams.
One school does not want to warn teachers too much. They want to schedule all the exams into two days in such way that exams on some subjects are on the first day, and exams on all other (and only on them) are on second. You are to write a program, which will determine, if it is possible to schedule exams in this way so that all pupils will be able to do all their selected exams.
Input
On the first line of input there are two integers N and M (1<=N<=200, 1<=M<=30000)  the number of available subjects and the number of pupils. Then M lines follows; on ith of them there are two integers  the numbers of exams, which were selected by ith pupil. Exams are numerated from 1 to N.
Output
If the solution exists, write on the first line of output only one word "yes". On the second line write the total number of exams, which must be held on first day, and on the third line  the numbers of subjects of this exams. If there exist several solutions, output any. If no solution exists, write to output only one word "no".
Sample test(s)
Input
4 4
1 2
3 4
2 4
1 3
Output
yes
2
1 4
Author:  NNSU#2 team

Resource:  Lazurny olympiad in informatics

Date:  JulyAugust 2002

Server time: 20160827 22:39:25  Online Contester Team © 2002  2016. All rights reserved. 

