#include<stdio.h>#include<string.h>#include<stdlib.h>#include<ctype.h>int main(void){ int len,start,n; int i,j,to; int mat[21],cnt,odd; char c[100]; while ( scanf("%s",c) && strcmp(c,"ENDOFINPUT") ) { scanf("%d%d",&start,&n);getchar(); memset(mat,0,sizeof(mat)); for( i = 0,cnt=0; i < n; i++ ) { gets(c); len = strlen(c); if( len == 0 ) continue; for( j = 0;j <= len;j++ ) { to = 0; while( isdigit(c[j]) ) to = to * 10 + c[j++] - '0'; mat[i]++; mat[to]++; cnt++; } } gets(c); for( odd=i=0; i <n; i++) if( mat[i]%2 ) odd++; if( odd > 2 || odd == 1 ) printf("NOn"); else if( odd == 2 ) (start && mat[start]%2&&mat[0]%2)?printf("YES %dn",cnt):printf("NOn"); else start==0?printf("YES %dn",cnt):printf("NOn"); } return 0;}