#include<stdio.h>
#include<string.h>
#include<iostream>
#include<sstream>
using namespace std;
char s[1005];
int d[105];
int main(){
int i,j,n,m,x,y,add,odd;
while(gets(s)){
if(strcmp(s,"ENDOFINPUT")==0) break;
if(s[0]=='S'){
sscanf(s,"%*s%d%d\n",&m,&n);
memset(d,0,sizeof(d));
add=odd=0;
for(i=0;i<n;i++){
string in;
getline(cin,in);
stringstream str(in);
while(str >> x){
d[i]++,d[x]++,add++;
}
}
for(i=0;i<n;i++){
if(d[i]%2){
odd++;
if(odd==1) x=i;
if(odd==2) y=i;
}
}
if(odd==0 && m==0) printf("YES %d\n",add);
else if(odd==2 && d[m]%2 && d[0]%2 && m!=0) printf("YES %d\n",add);
else puts("NO");
scanf("%s",s);
}
}
}
沒有留言:
張貼留言