int main()
{
int i=0,b=0,a,flag=0;
char str1[200];
cin.getline(str1,200);
a=strlen(str1);
char *p;
p = str1;
while (i<a)
{
 	  if (str1[i]<'0' || str1[i]>'9')
 	  {
	  p++;
	  i++;
	  continue;
	  }
	  cout << *p;
	  if (str1[i+1]<'0' || str1[i+1]>'9')
	  {
			cout<<endl;

	  		flag++;
 	   }

			p++;
	  		i++;

}

}


int main()
{
	char str[40];
	char *p=str;
	cin.getline(str,31);
	for(;*p!='\0';p++)
	{
		if(isdigit(*p)) cout<<*p;
		else cout<<endl;
	}
}


int main(int argc, char* argv[])
{
	int i;
	char string[30];
	gets(string);
	for(i=0;i<30;i++){
		if(string[i]=='0'||string[i]=='1'||string[i]=='2'||string[i]=='3'||string[i]=='4'||string[i]=='5'||string[i]=='6'||string[i]=='7'||string[i]=='8'||string[i]=='9'){
	printf("%c",string[i]);}
	else{
	printf("\n");}}
return 0;}


int main()
{
char a[30];
int i,ok;
gets(a);
for (i=0;i<strlen(a);i++)
if (!(*(a+i)>='0'&&*(a+i)<='9'))
{
	ok=1;
	continue;
}
else
{
if (ok) printf("\n");
ok=0;
printf("%c",*(a+i));
}
return 0;
}


int main()
{
	char hello[33];
	int count,i=0;

	cin.getline(hello,33);

	while(hello[i]!='\0')
	{

		if(hello[i]>='0'&&hello[i]<='9')
			{
				cout<<hello[i];
				count=0;
		    }
		else
		{
			if(count==0)
				{
					cout<<endl;
					count++;
			    }

		}
		i++;
	}
	cout<<endl;
	return 0;
}


int main()
{
	char C[500];
	char *P;
	gets(C);
	P = C;
	int L = strlen(P);
	for (int I = 0; I < L; I ++)
		if (P[I] >= '0' && P[I] <= '9')
		{
			int J;
			for (J = I; J < L; J ++)
				if (P[J] >= '0' && P[J] <= '9') cout << P[J]; else break;
			I = J;
			printf("\n");
		}
}


int main()
{
    char *p;
    p=(char *)malloc(1000*sizeof(char));
    gets (p);
    int i;
    for (i=0;*(p+i)!='\0';i++)
    {
        if (isdigit(*(p+i)))
        printf ("%c",*(p+i));
        if (isdigit(*(p+i))&&isdigit(*(p+i+1))==0)
        printf ("\n");
    }
    return 0;
}


int main()
{
	char a[32];
	int i, flag = 0;
	cin.getline(a, 32);
	for(i = 0;a[i] != '\0';i++)
	{
		if(a[i] - '0' < 10 && a[i] - '0' > -1)
		{
			cout << a[i];
			flag = 1;
		}
		else if(flag == 1)
		{
			cout << endl;
			flag = 0;
		}
	}
	cout << endl;
	return 0;
}


void main()
{

char *p,*r;
p=(char*)malloc(30*sizeof(char));
gets(p);

for(r=p;*r!='\0';r++)
if ((*r>57)||(*r<48)) printf("\n");
else printf("%c",*r);

}


int main ()
{
	char c[31];
	cin.getline(c,31);
	int n = sizeof(c);
	for (int i = 0; i < n; i++)
	{
		if (isdigit(c[i]))
			cout << c[i];
		else
			cout << endl;
	}
	return 0;
}


int main()
{
    char input[50];
    int output=0,i,k=0,l;
    gets(input);
    l=strlen(input);
    for(i=0;i<=l-1;i++){
                        if(input[i]>=48&&input[i]<=57){
                                                    output=10*output+(input[i]-48);
                                                    k++;
                                                     }
                        else{
                             if(k>0&&input[i-1]>=48&&input[i-1]<=57)
                             {printf("%d\n",output);
                             output=0;}
                             }
                        }
    if(output!=0){printf("%d", output);}
    return 0;
}


int main(void)
{
    int ch, num = 0, flag = 0, count = 0;

    while(ch = getchar())
    {
              if(!isdigit(ch) && flag)
              {
                      printf("%d\n", num);
                      count++;
                      num = flag = 0;
              }
              if(isdigit(ch))
              {
                    num  = 10 * num + ch - '0';
                    flag = 1;
                    continue;
              }
              if(ch == '\n')break;

    }

    return 0;
}


int main(){
	char p[31];
	cin.getline(p,31);
	int i;
	for (i=0;1;i++){
		if ((p[i]>='0')&&(p[i]<='9'))
			cout<<*(p+i);
		else if (p[i]=='\0')
			break;
		else
			cout<<endl;
	}
	return 0;
}


int main()
{
	char a[31] ;
	cin.getline(a , 31) ;
	int length = strlen(a) ;
	int flag = 0 ;
	char *p = a ;
	for(int i = 0 ; i<length ; i++ , p++)
	{
		if(!(((int)*p>='0')&&((int)*p<='9')))
		{
			 if(flag == 0)
				cout<<endl ;
			flag = 1 ;
		}
		else
		{
			cout<<*p ;
			flag = 0 ;
		}
	}
	return 0 ;
}


/*
 * 001.cpp
 * name:????
 *  Created on: 2011-12-25
 *      Author: 11029
 */
int main(){
	char c;
	int flag=1;
	while ((c=getchar())!='\n')
	{
		if (c>='0'&&c<='9')
		{
			cout<<c;
			flag=0;
		}
		else
		{
			if (flag==0)
				cout<<endl;
			flag=1;
		}
	}
	return 0;
}


int shuzi(char a)
	{
		if(48<=a&&a<=57)
			return 0;
		else return 1;
}
int main()
{
	char a[100];
	gets(a);
	char *p=a;
	while(*p!='\0')
	{
		if(shuzi(*p)==0)
			cout<<*p;
		if(shuzi(*p)==1&&shuzi(*(p-1))==0)
			cout<<endl;
		p++;
	}
	return 0;
}


/*
 * 1.cpp
 *
 *  Created on: 2011-12-25
 *      Author: Administrator
 */
char a[50];
void print(int x, int y)
{
	if(x>y) return;
	int i;
	for(i=x;i<=y;i++)
		cout<<a[i];
	cout<<endl;
}

int main()
{

	int i,k,l;
	gets(a);
	l=strlen(a);
	k=0;
	for(i=0;i<l;i++){
		if(a[i]<='9' && a[i]>='0') continue;
		print(k,i-1);
		k=i+1;
	}
	print(k,i-1);
	return 0;
}


int main()
{
 char words[MAXNUM],temp[MAXNUM];
 gets(words);
 int len1,len2,ans;
 len1=strlen(words);
 len2=0;
 for(int i=0;i<len1;i++)
 {
  if(words[i]>=48&&words[i]<=57)
   temp[len2++]=words[i];
   else
   {
    if(len2>=1)
    {
      temp[len2]='\0';
      cout<<(int)atof(temp)<<endl;
      len2=0;
    }
    else
     continue;
   }
 }
 if(len2>=1&&(words[len1-1]>=48&&words[len1-1]<=57))
 {temp[len2]='\0';
 cout<<(int)atof(temp);}
 return 0;
}


int main()
{
char *a;
int i,ok;
a=(char*)malloc(sizeof(char)*30);
gets(a);
for (i=0;i<strlen(a);i++)
if (!(*(a+i)>='0'&&*(a+i)<='9'))
{
	ok=1;
	continue;
}
else
{
if (ok) printf("\n");
ok=0;
printf("%c",*(a+i));
}
return 0;
}


int main()
{
    char a[30];
    gets(a);
    int k;
    for(int i=0;i<strlen(a);i++)
    {
        if(a[i]>='0'&&a[i]<='9')
         {
           for(int j=i;j<strlen(a);j++)
         {
            if(a[j]<'0'||a[j]>'9')
            {
               cout<<endl;
               break;
            }
            cout<<a[j];
            k=j;
         }
         i=k;
         }
    }
   return 0;
}


//????

char out[100];
int ct, sig;

int main()
{
	char x;
	while ( (x = cin.get()) != '\n' ) {
		if ( x >= '0' && x <= '9' ) {
			out[ct] = x;
			++ct;
			sig = 1;
		}
		else if ( sig ) {
			out[ct] = '\n';
			++ct;
			sig = 0;
		}
		else continue;
	}

	for ( int i = 0; i != ct; ++i ) cout << out[i];
	if ( out[ct - 1] != '\n' ) cout << endl;

	return 0;
}


int main()
{
char c[50];
int i=0,flag=0;
gets(c);
while (i<=strlen(c))
{
if (c[i]>='0'&&c[i]<='9')
	if (flag==0) {flag=1;printf("\n%c",c[i]);} else printf("%c",c[i]);
else flag=0;
i++;
}
}


int main(){
	char a[31];
	cin.getline(a,31);
	int len=strlen(a);
	for(int i=0;i<len;i++){
		if('0'<=a[i]&&a[i]<='9') cout<<a[i];
		else{
			cout<<endl;
			for(int j=i;j<len;j++){
				if('0'<=a[i]&&a[i]<='9'){
					cout<<a[j];
					break;
				}
				i++;
			}
		}
	}
	return 0;
}


int main(){
	int i,sum=0,f=1;

	char *p=(char *)malloc(sizeof(char)*100);
	gets(p);
	for (i=0;i<strlen(p);i++)
		if (*(p+i)>=48 && *(p+i)<=57) {
			f=0;sum=0;printf("%c",*(p+i));
		}
		else {
			sum++;
			if (sum==1 && f==0) printf("\n");
		}
	free(p);
}


int main()
{
	char str[31];
	char *p=str;
	cin.getline(str,31);
	int l=strlen(str);
	for(p=&str[0];p<&str[0]+l;p++)
	{
		if(*p>='0'&&*p<='9') cout<<*p;
		else if(*(p+1)>='0'&&*(p+1)<='9') cout<<endl;
	}
	return 0;
}


/*
 * coutnum.cpp
 * ????
 *  Created on: 2012-12-14
 *      Author: 12219
 */
int main() {
	char a[30], *p;
	int b;
	cin.getline(a, 31);
	b = strlen(a);
	for (p = a; p < a + b; p++) {
		if (*p >= '0' && *p <= '9')
			cout << *p;
		else
			cout << endl;
	}
	return 0;
}


int main()
{
	char c;
	while (c != '\n')
	{
		scanf("%c",&c);
		if(c >= '0' && c <= '9')
			printf("%c",c);
		else
			printf("\n");
	}
	return 0;
}


int main()
{
	int i=0,l,flag;
	char c[31];
	cin.getline(c,31);
	for(i=0;;i++)
		if(c[i]=='\0')
			break;
	l=i;
	char *a=c;
	for(i=0;i<l;i++)
		if(*(a+i)>='0'&&*(a+i)<='9')
			{
				cout << *(a+i);
				flag=0;
			}
		else
			if(flag==0)
				{
					cout << endl;
					flag=1;
				}
	return 0;
}


void main()
{
	char *str,*p;
	int k=1;
	str=(char *)malloc(30*sizeof(char));
	gets(str);
	p=str;
	for(;p<str+30;p++)
	{
		if(*p>='0'&&*p<='9'){printf("%c",*p);k=1;}
		else if(k){printf("\n");k=0;}
	}
	free(str);
}


int main( )
{
	char test[MAX_LENGTH];
	char *pTest=test;
	cin.getline(test,MAX_LENGTH);
	while(true) //??????
	{

		if(*pTest==0) break;

		if (*pTest>='0'&&*pTest<='9')  //????
		{
			cout<<*pTest;
			if (*(pTest+1)<'0' ||*(pTest+1)>'9')
				cout<<endl;
		}
		pTest++;
	}
	return 0;
}


int main()
{
	int i,l,flag;
	char s[31];
	cin.getline (s,31);
	l = strlen (s);
	flag = 0;
	for (i = 0; i <= l-1 ; i++)
		if ((s[i] >= '0') && (s[i] <= '9'))
		{
			flag = 1;
			cout << s[i];
		}
		else
		{
			if (flag == 1)
				cout << endl;
			flag = 0;
		}
	return 0;
}


int main()
{
    char *p;
    int i,l;
    p=(char *)malloc(30*sizeof(char));
    gets(p);
    l=strlen(p);
    for (i=0;i<l-1;i++)
    {

        if (isdigit(*(p+i)))
        printf("%c",*(p+i));
        if (isdigit(*(p+i))&&isdigit(*(p+i+1))==0)
        printf("\n");
    }
    if (isdigit(*(p+l-1)))
    printf("%c",*(p+l-1));
    return 0;
}


int main()
{
	char a[40];int i;
	cin.getline(a,31,'\n');
	for(i=0;i<strlen(a);i++)
		if(a[i]>='0'&&a[i]<='9')
			cout<<a[i];
		else cout<<endl;
	return 0;
}


//
//  Created by Chu-Pan,Wong on Dec 10, 2013.
//  Copyright (c) 2013 ChuPan,Wong. All rights reserved.
//

int main(int argc, char** argv){
    char s[31];
    gets(s);
    int len = (int)strlen(s);
    char* p=s;
    char* q;
    for (int i = 0; i<len; i++){
        if (*(p+i) >= '0' && *(p+i) <= '9') {
            q = p+i;
            i++;
            while (*(p+i) >= '0' && *(p+i) <= '9') {
                i++;
            }
            *(p+i) = 0;
            printf("%s\n", q);
        }
    }
    return 0;
}


int main()
{
	char a[31];
	int i;
	cin.getline(a, 31);
	for (i = 0; i < strlen(a); i++)
	{
		if (isdigit(a[i]))
		{
			if (!isdigit(a[i+1]))
				cout << a[i] << endl;
			else
				cout << a[i];
		}
	}
	return 0;
}


int main()
{const int maxn=31;
  char c[maxn],*p;

  gets(c);
  p=c;
  while(*p!='\0')
    if(*p>=48 && *p<58)
    { do{
   	    cout<<*p;
        p++;
      }while(*p>47 && *p<58);
      cout<<endl;
    } else p++;

  return 0;
}


int main()
{
    char input_number[30];
    gets(input_number);

    int indicator;
    int cool=0;
    for(indicator=0;indicator<strlen(input_number);indicator++)
    {
        if(isdigit(input_number[indicator]))
        {
        cool=0;
        putchar(input_number[indicator]);
        }
        else if(cool==0)
        {
            printf("\n");
            cool=1;
        }
    }
    return 0;
}


int main()
{
	char* string=(char*)malloc(30);
	gets(string);
	char *p=string;
	int len=strlen(string);
	for(;p<string+len;p++)
	{
	    int anynumber=0;
		while(*p>='0'&&*p<='9')
	    {
		printf("%c",*p);
		p++;
		anynumber++;
	    }
		if(anynumber)
		{
			printf("\n");
		}
	}
}


/*
 * 12-4.cpp
 *
 *  Created on: 2011-12-25
 *      Author: sony
 */

int main()
{
	char input[35];
	cin.getline(input, 35);
	int i, j;
	int len = strlen(input);
	for (i = 0; i < len; i++){
		if (input[i] >= '0' && input[i] <= '9') {
			cout << input[i];
			for (j = i + 1; ; j++) {
				if (input[j] >= '0' && input[j] <= '9') {
					cout << input[j];
				} else {
					cout << endl;
					break;
				}

			}
			i = j;
		}
	}
	return 0;
}


void main()
{
	int a;
	int i=0;
	for(;a!='\n';)
	{
	a=getchar();
	if(a>=48 && a<=57)
	{printf("%c",a);i=0;}
	else if((a<48 || a>57)&&(i==0))
	{i++;printf("\n");continue;}
	else continue;
	}
}


int main()
{
   char str[30];
   gets(str);
   char *str_pointer;
   str_pointer=str;
   int i,flag,count;
   flag=count=0;
   for(i=0;str[i];i++)
   {
	   if(str[i]>='0'&&str[i]<='9')
	   {
		 printf("%c",str[i]);
		 flag=0;
	   }
	   else if(flag==0)
	   {
		   printf("\n");
		   flag=1;
	   }
   }
   return 0;
}


// ????1.cpp : Defines the entry point for the console application.
//

int main()
{
	char num[31];
	char*p;
	char*m;
	int i = 0;

	cin.getline(num,31);

	int len = strlen( num );

	p = num;
	m = num;

	for( i = 0;i < len;i++ )
	{
		if( (*p) - '0' >= 0 && (*p) - '0' <= 9 )
			cout << *p;
		else
			if( *(p - 1) - '0' >= 0 && *( p - 1 ) - '0' <= 9 )
				cout << endl;
		p++;

	}

	return 0;
}


int main(int argc, char *argv[])
{
  int i,j,k;
  char c[50];
  gets(c);
  k=strlen(c);
  for(i=0;i<k;i++)
  {
   if(c[i]>=48&&c[i]<=57)
   {
    if(c[i+1]>=48&&c[i+1]<=57)printf("%c",c[i]);
    else
    printf("%c\n",c[i]);
   }
  }

  return 0;
}


main()
{
      char s[30],num[30];
      gets(s);
      int l;
      l=strlen(s);
      int k=0;
      for (int i=0;i<l;i++)
      {
          if (s[i]>='0'&&s[i]<='9')
          {
              num[k]=s[i];
              k++;
          }
          else
          {
              if (k!=0)
              {
                       for (int j=0;j<k;j++)
                          printf("%c",num[j]);
                       printf("\n");
                       k=0;
              }
              else k=0;
          }
      }
      if (k!=0)
      {
         for (int j=0;j<k;j++)
            printf("%c",num[j]);
         printf("\n");
      }
      getchar();
      getchar();
}


//leave out and get the integers in a string
int a[30];
char str[31];
char *pt=str;
int getint()
{
    if(*pt=='\0')return -1;
    int sum=0;
    while ('0'<=*pt&&'9'>=*pt){//the egg pain segmentation fault!
        sum*=10;
        sum=sum+*pt-'0';
        pt++;}
    return sum;
}
void skipstring()
{
    while(*pt&&(*pt<'0'||*pt>'9'))
        pt++;
}
int main()
{
    gets(str);
    int i=0;
    for (i=0;i<30;i++)
        a[i]=-1;//means initialized
    i=0;
    while(*pt!='\0')
    {
        skipstring();
        a[i]=getint();
        i++;
    }
    for(i=0;i<30;i++)
        if(a[i]!=-1)printf("%d\n",a[i]);
    return 0;
}


main()
{
      int n,x,y,u;
      scanf("%d",&n);
      int *a = (int *)malloc(n*sizeof(int));
      for(int i=0;i<n;i++)
      a[i]=0;
      u=0;
      for(int i=0;;i++)
      {
                   scanf("%d %d",&x,&y);
                   if((x==0)&&(y==0))
                   break;
                   a[y]++;
                   a[x]--;
      }
      for(int i=0;i<n;i++)
      {
              if(a[i]==n-1)
              {
              printf("%d",i);
              break;
              }
              u++;
      }
      if(u==n)
      printf("NOT FOUND");
      free(a);

}


void work(int m);
int main(){
    int n;
    scanf("%d",&n);
    work(n);
    return 0;
}
void work(int m){
    int a[m],b[m];
    int i,j,k,man,hear,l;
    l=0;
    for(i=0;i<=m-1;i++){//chushihua
        a[i]=1;
        b[i]=0;
    }
    for(j=1;j<=m*m;j++){
        scanf("%d %d",&man,&hear);
        if(man==hear)break;
        a[man]=0;
        b[hear]=b[hear]+1;
    }
    for(k=0;k<=m-1;k++){
        if(a[k]==1){
            if(b[k]==m-1){
                printf("%d",k);
                l=1;
                break;
            }

        }
    }
    if(l==0)printf("NOT FOUND");

}


int main()
{
	int i,n;
	scanf("%d",&n);
	int *renshi=(int *)malloc(sizeof(int)*n);
	memset(renshi,0,sizeof(int)*n);
	int *beiren=(int *)malloc(sizeof(int)*n);
	memset(beiren,0,sizeof(int)*n);
	while(1)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)
			break;
		renshi[a]++;
		beiren[b]++;
	}
	for(i=0;i<n;i++)
	{
		if(renshi[i]==0&&beiren[i]==n-1)
		{
			printf("%d\n",i);
			break;
		}
	}
	if(i==n)
		printf("NOT FOUND\n");
}


int main()
{
  int n;
  scanf("%d",&n);
  int*p;
  p=(int*)malloc((n*n)*sizeof(int));
  int*y;
  y=(int*)malloc((n*n)*sizeof(int));
  int i,j;
  for(i=0;i<n*n;i++)
  {
  scanf("%d %d",&p[i],&y[i]);
  if(p[i]==0&&y[i]==0)
  break;
  }
  p[i]=-100000;
  y[i]=-100000;
  int  k;
  k=i;
  int*d;
  d=(int*)malloc(n*sizeof(int));
  for(i=0;i<n;i++)
  d[i]=0;
  for(i=0;i<n;i++)
  {
   for(j=0;j<k;j++)
   {
    if(p[j]==i)
    break;
    if(y[j]==i)
    d[i]++;
   }
   if(d[i]==n-1)
   {
   printf("%d",i);
   break;
   }
  }
  if(i==n)
  printf("NOT FOUND");

  free(p);
  free(y);
  free(d);
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();

}


int a[10000];
int b[10000];
int main()
{
    int l,r,i,j;
    int n;
    cin>>n;
    memset(b,0,n);
    memset(a,0,n);
    while(cin>>l>>r&&(l!=0||r!=0)){b[l]=1;a[r]++;}
    for(i=0;i<n;i++)
    {
                    if(b[i]==1||a[i]<n-1) continue;
                    else break;
    }
    if(i>=n) cout<<"NO FOUND"<<endl;
    else cout<<i<<endl;
}


int main()
{
	int n,i,j,k,know,known,yes=0;
	scanf("%d",&n);
	int famous[n],chance[n];
	for(i=0;i<n;i++)famous[i]=0,chance[i]=1;
	for(i=0;;i++)
	{
		scanf("%d%d",&know,&known);
		if(know==0&&known==0)break;
		chance[know]--;
		famous[known]++;
	}
	for(i=0;i<n;i++)
	{
		if(chance[i]==1&&famous[i]==n-1){printf("%d\n",i);yes=1;}
	}
	if(yes==0)printf("NOT FOUND\n");
}


const int maxn=100000;
int r[maxn],o[maxn];
int main()
{
	int n,i,j;
	memset(r,0,sizeof(r));memset(o,0,sizeof(o));
	while (scanf("%d",&n)!=EOF)
	{
		for (scanf("%d%d",&i,&j);i!=0||j!=0;scanf("%d%d",&i,&j))
			o[i]++,r[j]++;
		for (i=0;i<n;i++) if (o[i]==0&&r[i]==n-1) break;
		if (i==n) puts("NOT FOUND");else printf("%d\n",i);
	}
	return 0;
}


const int MAXN = 1000100;

int n, d[MAXN], r[MAXN];

int main()
{
	int x, y, i;

	scanf("%d", &n);
	memset(d, 0, sizeof(d));
	memset(r, 0, sizeof(r));
	while (scanf("%d%d", &x, &y), x+y!=0){
		r[x]++;
		d[y]++;
	}
	for (i=0; i<n; i++)
		if (r[i]==0 && d[i]==n-1) break;
	if (i==n)
		printf("NOT FOUND\n");
	else
		printf("%d\n", i);

	return 0;
}


main()
{
    int n,a,b,i,icount;
    int know[10000],known[10000];
    scanf("%d",&n);
    for(i=0;;i++)
    {
        scanf("%d",&a);
        scanf("%d",&b);
        if(a==0&&b==0)
            break;
        else
        {
            know[a]++;
            known[b]++;
        }
    }
    icount=0;
    for(i=0;i<n;i++)
    {
        if(know[i]==0&&known[i]==n-1)
        {
            printf("%d\n",i);
            icount++;
        }
    }
    if(icount==0)
    printf("NOT FOUND");
    getchar();
    getchar();
}


/*
 * ceyan5.cpp
 *??:??????
 *  Created on: 2011-1-8
 *      Author: 10154
 */

int main(){
	int n,i,j;
	cin>>n;
	const int N=n;
	int knowme[N];
	for(i=0;i<n;i++)knowme[i]=0;
	i=0;j=0;
	cin>>i>>j;
	while(i!=0||j!=0){
		knowme[j]++;
		cin>>i>>j;
	}
	j=0;
	for(i=0;i<n;i++)
		if(knowme[i]==n-1){
			j=1;
			cout<<i<<endl;
		}
	if(j==0)cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
	struct person
	{
		int j;
		int count;
	} p[10000];
	int n, k = 1, i;
	cin >> n;
	for (i = 0; i < n; i++)
		p[i].count = 0;
	while(1)
	{
		cin >> i;
		cin >> p[i].j;
		if (i == 0 && p[i].j == 0)
			break;
		p[p[i].j].count++;
	}
	for (i = 0; i < n; i++)
	{
		if (p[i].count == n - 1)
		{
			cout << i;
			k = 0;
		}
	}
	if (k)
		cout << "NOT FOUND";
	return 0;
}


main()
{
      int n;
      scanf("%d",&n);
      int a[n];
      for(int i=0;i<n;i++)   a[i]=0;
      int p,q;
      for(int j=0;;j++)
      {
              scanf("%d %d",&p,&q);
              if(p==0&&q==0) break;
              else
              {

                    a[q]++;
              }
      }
      int flg=0;
      for(int k=0;k<n;k++)
      {
              if(a[k]==n-1)
              {
                      printf("%d",k);
                      flg=1;
              }
      }
      if(flg==0)  printf("NOT FOUND");

}


int main()
{
	int mingliu(int k,int **pp,int n,int count);
	int**pp,n,mingliushu=0;
	scanf("%d",&n);
	pp=(int**)malloc(sizeof(int*)*n*n+1);
	int q=0;
	while(1)
	{
       pp[q]=(int *)malloc(sizeof(int)*2);
	   scanf("%d %d",pp[q],pp[q]+1);
	   if(*pp[q]==0&&*(pp[q]+1)==0)
		   break;
       q++;
	}
    for(int i=0;i<q;i++)
	{
		if(*(pp[i]+1)>=0)
		mingliushu+=mingliu(*(pp[i]+1),pp,n,q);
	}
	if(mingliushu==0)
		printf("NOT FOUND");
	free(pp);
	pp=NULL;
	return 0;
}

int mingliu(int k,int **pp,int n,int count)//k??????????????
{
	int *a;
	a=(int*)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++)
		*(a+i)=0;
	int value=1;
			for(int j=0;j<count;j++)
			{
				if(*(pp[j]+1)==k)
				{
					*(pp[j]+1)=-k-1;
					*(a+pp[j][0])=1;

				}
			}
			*(a+k)=1;
			for(int j=0;j<n;j++)
			{
				if(*(a+j)==0)
				{
					value=0;
					break;
				}
			}
			if(value==1)
				printf("%d",k);
			free(a);
return value;
}


int main()
{
	int i,n,k=0,know,known;
	scanf("%d",&n);
	int * flag =(int *) malloc(sizeof(int)*n);
	int * knownum =(int *) malloc(sizeof(int)*n);
	for( i = 0; i < n; i ++){
		flag[i]=0;
		knownum[i]=0;
	}

	while(1){
		scanf("%d %d",&know,&known);
		if(know == 0 && known ==0)
			break;
		flag[know]=1;
		knownum[known]++;
	}

	for(i = 0; i < n; i ++)
		if(flag[i] ==0 && knownum[i]==n-1){
			k=1;
			printf("%d\n",i);
		}

	if(k == 0)
		printf("NOT FOUND\n");

	return 0;
}


/*
 * FamousPerson.cpp
 *
 *  Created on: 2013-12-13
 *      Author: KEVIN
 */

int main()
{
	int n;
	cin>>n;
	struct{int knows,known;} person[n];
	memset(person,0,sizeof(person));
	while(1)
	{
		int i,j;
		cin>>i>>j;
		if(i==j)break;
		person[i].knows++;
		person[j].known++;
	}
	for(int i=0;i<=n-1;++i)
	{
		if(person[i].known==n-1 && person[i].knows<n-1)
		{
			cout<<i;
			break;
		}
		else
		{
			if(i==n-1)cout<<"NOT FOUND";
		}
	}
	return 0;
}


int main()
{
	int n;
	int *exclusion;
	int *refCount;
	int a,b;
	int i;
	int found;
	scanf("%d",&n);
	exclusion=(int*)malloc(sizeof(int)*n);
	refCount=(int*)malloc(sizeof(int)*n);
	memset(exclusion,0,sizeof(int)*n);
	memset(refCount,0,sizeof(int)*n);

	while(1)
	{
		scanf("%d %d",&a,&b);
		if (a==0 && b==0) break;
		exclusion[a]=1;
		refCount[b]++;
	}

	found=0;
	for (i=0;i<n;i++)
		if (!exclusion[i] && refCount[i]>=n-1) {printf("%d\n",i); found=1;}

	if (!found) printf("NOT FOUND\n");

	free(exclusion);
	free(refCount);

	return 0;
}


int main()
{
    int n;
    int a[100000];
    cin>>n;
    for (int i=0;i<n;i++) a[i]=0;
    int i,j;
    cin>>i>>j;
    while (i!=0||j!=0)
    {
          a[j]++;
          cin>>i>>j;
    }
    for (int i=0;i<n;i++)
        if (a[i]==n-1) cout<<i<<endl;

    return 0;
}


int main()
{
	int n, i, j, k;
	char **map;

	scanf("%d", &n);
	map = (char**)malloc(n*sizeof(char*));
	for(i=0; i<n; i++)
		map[i] = (char*)malloc(n*sizeof(char));
	for(i=0; i<n; i++)
		for(j=0; j<n; j++)
		{
			if(i==j)
				map[i][j] = 1;
			else
				map[i][j] = 0;
		}
	while(scanf("%d %d", &i, &j) && i+j!=0)
		map[i][j] = 1;

	k = 0;
	for(j=1; j<n; j++)
	{
		if(map[k][j] == 1)
			k = j;
	}
	for(i=0; i<k; i++)
	{
		if(map[i][k]==0 || map[k][i]==1)
		{
			printf("NOT FOUND");
			for(i=0; i<n; i++)
				free(map[i]);
			free(map);
			return 0;
		}
	}
	printf("%d", k);
	for(i=0; i<n; i++)
		free(map[i]);
	free(map);
	return 0;
}


int main()
{
    int n, i, j;
    scanf("%d", &n);

    /* initialization */
    char **r_matrix = (char **)malloc(sizeof(char *) * n);
    for(i = 0; i < n; ++i)
    {
        r_matrix[i] = (char *)malloc(sizeof(char) * n);
        for(j = 0; j < n; ++j)
        {
            if(i == j)
                r_matrix[i][j] = 1;
            else
                r_matrix[i][j] = 0;
        }
    }

    /* input */
    while(1)
    {
        scanf("%d %d", &i, &j);
        if(!( i || j ))
            break;
        r_matrix[i][j] = 1;
    }

    int vip = 0, not_found = 0;
    for(i = 0; i < n; ++i)
        if(r_matrix[vip][i])
            vip = i;

    for(i = 0; i < vip; ++i)
    {
        if(i == vip)
            continue;
        if(!(r_matrix[i][vip] && !r_matrix[vip][i]))
        {
            not_found = 1;
            break;
        }
    }
    if(not_found)
        printf("NOT FOUND\n");
    else
        printf("%d\n", vip);

    for(i = 0; i < n; ++i)
        free(r_matrix[i]);
    free(r_matrix);
    return 0;
}


	int a[1000005],b[1000005],va,vb;
int main()
{
	int n,time=0,much,flag=0;
	cin>>n;
	cin>>va>>vb;
	while((va!=0)||(vb!=0))
	{
		a[time]=va;
		b[time]=vb;
		time++;
		cin>>va>>vb;
	}
	a[time]=va;
	b[time]=vb;
	for(int i=0;i<n;i++)
	{
		much=0;
		for(int j=0;j<=time;j++)
		{
			if(b[j]==i)
			much++;
		}
		if(much>=n-1)
		{
			flag=1;
			for(int j=0;j<=time;j++)
			{
				if((a[j]==i)&&(b[j]!=i))
				{
						flag=0;
						break;
				}
			}
			if(flag==1)
			{
				cout<<i<<endl;
				break;
			}
		}
	}
	if(flag==0)
	cout<<"NOT FOUND"<<endl;

	return 0;
}


// ??????.cpp : ??????????????
//

int main()
{
	struct celebrity
	{
		int num;
		int no;
	}knowed[10000];
	int x = 0,y = 0,temp,n,j = 0,k = 0,ins;
	cin >> n;
	for (;;)
	{
		cin >> temp;
		cin >> ins;
		if (temp + ins == 0)
		{
			break;
		}
		if (knowed[ins].num < 0)
		{
			knowed[ins].num = 0;
		}
		if (knowed[ins].num >= 0)
		{
			knowed[ins].num++;
		}
	}
	for (j = 0;j <= n - 1;j++)
	{
		if (knowed[j].num == n - 1)
		{
			cout << j << endl;
			y = 1;
			break;
		}
	}
	if (y == 0)
	{
		cout << "NOT FOUND" << endl;
	}
	return 0;
}


const int N = 1000000;
int cnt[N] = {0};
int main()
{
	int n;
	cin >> n ;
	int a, b;
	int ans = -1;
	while (true)
	{
		cin >> a >> b;
		if ( a == 0 && b == 0) break;
		cnt[b]++;
		if (cnt[b] == n-1)
			ans = b;
	}
	if (ans == -1)
		cout << "NOT FOUND" << endl;
	else
		cout << ans << endl;
}


int main()
{
	const int N=10000;
	int a[N]={0},b[N]={0};
	int n;
	scanf("%d",&n);
	int x,y;
	scanf("%d%d",&x,&y);
	while(x || y)
	{
		a[x]=1;
		b[y]++;
		scanf("%d%d",&x,&y);
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]) continue;
		if(b[i]==n-1)
		{
			printf("%d",i);
			exit(0);
		}
	}
	printf("NOT FOUND");
	return 0;
}


int t[10000000];
int main(){
    int n, i, j;
    scanf("%d", &n);
    while(scanf("%d%d", &i, &j), i||j){
        t[j]++;
        t[i]--;
    }
    for(i = 0; i< n; i++){
        if(t[i] == n-1){
             printf("%d", i);
             break;
        }
    }
    if(i == n)printf("NOT FOUND");
    return 0;
}


main()
{
   int N,i,A,B;
   int a[1000000],b[1000000];
   scanf("%d",&N);                     //???
   int c[N];
   for(i=0;i<N;i++)
   {c[i]=N;}
   i=0;
   while(scanf("%d %d",&A,&B)&&((A*A+B*B)!=0))
   {
      c[A]=0;
      a[i]=A;
      b[i]=B;
      i++;}

   for(i;i>0;i--)
   {
    c[b[i-1]]--;
                  }
    int k=0;
    for(i=0;i<N;i++)
    {
    if(c[i]==1)
    printf("%d",i);
     else
     k++;
        }
    if(k==N)
    printf("NOT FOUND") ;

    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
   }


int main()
{
    int n,j,k,count=0,l,i;
    scanf("%d",&n);
    int *a=(int *)malloc(n*n*sizeof(int));
    int *b=(int *)malloc(n*n*sizeof(int));
    for(i=0;i<=n*n-1;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0&&b[i]==0)
        {
            break;
        }
        count++;
    }
    int *c=(int *)malloc(n*sizeof(int));
    for(l=0;l<=n-1;l++)
    {
        c[l]=1;
    }
    for(j=0;j<=count-1;j++)
    {
        c[b[j]]++;
    }
    for(k=0;k<=n-1;k++)
    {
        if(c[k]==n)
        {
            printf("%d",k);
            break;
        }
    }
    if(k==n)
    {
        printf("Not Found!");
    }
}


int main()
{
int n,i,j,k=1,c,d;
int **a;
int *p,*q;
scanf("%d",&n);
p=(int*)malloc(n*sizeof(int));
q=(int*)malloc(n*sizeof(int));
a=(int**)malloc(n*sizeof(int*));
for(i=0;i<n;i++)
	{
	a[i]=(int*)malloc(n*sizeof(int));
	p[i]=0;
	q[i]=0;
	}
while(k==1)
	{
		scanf("%d",&c);
		scanf("%d",&d);
		if(c==0&&d==0)
			break;
		if(a[c][d]!=1)
		{
			p[c]=1;
			q[d]++;
			a[c][d]=1;
		}
	}
for(i=0;i<n;i++)
{
	if(p[i]==0&&q[i]==n-1)
		{
			printf("%d",i);
			return(0);
		}
}
printf("NOT FOUND");
return(0);
}


int know[10000];
int main()
{
	memset(know, 0, sizeof(know));  //?????????????????????????n - 1??????????
	int n;
	cin >> n;
	int flag = 1;
	int i, j;
	for (;;)
	{
		cin >> i >> j;
		if (i == 0 && j == 0)
		{
			break;
		}
		else
		{
			know[i] = -1;
			know[j]++;
		}
	}
	for (int k = 0; k < n; k++)
	{
		if (know[k] == n - 1)
		{
			cout << k << endl;
			flag = 0;
			break;
		}
	}
	if (flag)
		cout << "NOT FOUND" << endl;
	return 0;
}


int main()
{
	char v[N];
	int n,i,j,a,b;
	int sign;

	scanf("%d",&n);
	for (i=0;i<n;i++)
		v[i]=1;
	while (1)
	{
		scanf("%d %d",&a,&b);
        if (a==0 && b==0)
			break;
		if (a!=b)
	    	v[a]=0;
	}
	sign=0;
	for (i=0;i<n;i++)
		if (v[i]==1)
		{
				if (sign==0)
					sign=1;
				printf("%d\n",i);

		}
	if (sign==0)
		printf("NOT FOUND\n");
	return 0;
}


int main()
{
	int n;
	cin>>n;
	int i;
	int flag=0;
	int a[10000];
	for(i=0;i<10000;i++)
	{
		a[i]=0;
	}
	int x,y;
	while(cin>>x>>y)
	{
		if(x==0&&y==0)
			break;
		a[y]++;
	}
	for(i=0;i<10000;i++)
	{
		if(a[i]==n-1)
		{
			cout<<i<<endl;
			flag=1;
			break;
		}
	}
	if(flag==0)
		cout<<"NOT FOUND"<<endl;
	return 0;
}


main()
{
  int n,i,j,k=0;
  scanf("%d",&n);
  int*a=(int*)malloc(n*sizeof(int));
  int*b=(int*)malloc(n*sizeof(int));
  for(i=0;i<n;i++)a[i]=0;
  for(i=0;i<n;i++)b[i]=0;
  scanf("%d %d",&i,&j);
  while((i+j)!=0)
  {
    a[i]++;
    b[j]++;
    scanf("%d %d",&i,&j);
  }
  for(i=0;i<n;i++)
  {
    if((a[i]==0)&&(b[i]==n-1))
    {
      printf("%d",i);
      k=1;
    }
  }
  if(k==0)printf("NOT FOUND");
  free(a);
  free(b);
  getchar();
  getchar();
  getchar();
  getchar();
}


main()
{   int n;
    int i,j;
    int flag=0;
    scanf("%d",&n);
    int*p=(int*)malloc(n*sizeof(int));
    for(int k=0;k<n;k++)
    {p[k]=0;
    }
    for(;;)
   {scanf("%d %d",&i,&j);
    if ((i==0)&&(j==0))
    break;
    p[j]+=1;
   }
    for(int o=0;o<n;o++)
   {if(p[o]==n-1)
    {printf("%d\n",o);
     flag+=1;
    }
   }
   if(flag==0)
   printf("NOT FOUND");
}


int main(void)
{
	int g=0,e=0;
	scanf("%d",&g);
	int *p=NULL,*a=NULL;
	p=(int *)malloc(g*g*sizeof(int));
	a=(int *)malloc(g*sizeof(int));

	//int p[10],a[3];
	for(int i=0;i<g;i++)
	{
		a[i]=88888;										//?????88888??
	}

	for(int i=0;i<g*g;i++)
	{
		p[i]=burenshi;
	}

	for(int i=0;i<g;i++)
	{
		p[i*g+i]=ziji;
	}

	int m=0,n=0;
	for(;;)
	{
		scanf("%d %d",&m,&n);
		if(m==0&&n==0)
		{break;}
		p[m*g+n]=renshi;
	}

	for(int i=0;i<g;i++)
	{
		int beknown=1,know=0;
		for(int j=0;j<g;j++)
		{
			know=know+p[i*g+j];
		}

		if(know!=ziji)
		{continue;}

		for(int j=0;j<g;j++)
		{
			beknown=beknown*p[j*g+i];
		}
		if(beknown==0)
		{
			continue;
		}

		a[e]=i;
			e++;
	}

	if(a[0]==88888)
	{printf("NOT FOUND");}

	else
	{
		for(int i=0;;i++)

		{
			if(a[i]==88888)
			{break;}

		printf("%d\n",a[i]);
		}
	}

	return 0;
}


main()
{
      int n,i,j,count=0,num=0,countf=0;
      scanf("%d",&n);
      int a[20000],b[20000];
      for(i=0;;i++)
      {
      scanf("%d %d",&a[i],&b[i]);
      if(a[i]==0&&b[i]==0)
      break;
      }
      i=0;
      while(i<n)
      {
                      countf=0;
                      count=0;
                      for(j=0;a[j]!=0||b[j]!=0;j++)
                      {
                      if(b[j]==i)
                      count=count+1;
                      if(a[j]==i)
                      countf=countf+1;
                      }
                     if((count==n-1)&&(countf==0))
                    {
                    num=num+1;
                    printf("%d",i);
                    }

                      i++;
      }
      if(num==0)
      printf("NOT FOUND");
      getchar();
      getchar();
}


int main()
{
	int Person[10000] = {0};
	int n;
	cin >> n;
	int i, j;
	while (cin >> i >> j && (i != 0 || j != 0))
	{
		Person[i] = 1;
		Person[j] ++;
	}
	for (i = 0; i < n; i++)
	{
		if (Person[i] == n - 1)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << "NOT FOUND" << endl;
	return 0;
}


int main()
{
	int n,relation[10000]={0},i,ans=-1;
	cin>>n;
	int a , b;
	while(cin>>a>>b)
	{
		if(a==0 && b==0) break;
		relation[a]++;
		relation[b]++;
	}
	for(i=0;i<n;i++)
	{
		if(relation[i]==n-1) ans=i;
	}
	if(ans==-1) cout<<"NOT FOUND"<<endl;
	else cout<<ans<<endl;
	return 0;
}


int main(){
	int *a;
	int *b;
	int n;
	int i,j,pd=0;
	int all;
	int k,m;
	int u,v;
	scanf("%d",&n);
	all=n*(n-1);
	a=(int*)malloc(sizeof(int)*n);
	b=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++){
		a[i]=0;
		b[i]=0;
	}
	for(i=0;i<all;i++){
		scanf("%d%d",&k,&m);
		if((k!=0)||(m!=0)){
			a[k]++;
			b[m]++;
			if((b[m]==n-1)&&(a[m]==0)){
				printf("%d",m);
				pd=1;
			}
		}
		else if ((k==0)&&(m==0)){
			break;
		}
	}
	if(pd==0){
		printf("NOT FOUND");
	}
	free(a);
	free(b);
	return 0;
	}


int know[10000],bknown[10000];
int main()
{
    int n,i,a,b;

    scanf("%d",&n);
    for(i=0;i<n;i++) know[i]=bknown[i]=0;
    while(scanf("%d%d",&a,&b))
    {
        if(a==b&&b==0) break;
        know[a]++;
        bknown[b]++;
    }
    for(i=0;i<n;i++)
        if(know[i]==0&&bknown[i]==n-1) break;
    if(i<=n) printf("%d\n",i);
    else printf("NOT FOUND\n");
    return 0;
}


main()
{
      int n;
      scanf("%d",&n);
      int *p;
      p=(int*)calloc(n,sizeof(int));

      int j,k;
      for(;;)
      {
              scanf("%d%d",&j,&k);
              if(j==0&&k==0)
              break;
              *(p+j)=-1;
              if(*(p+k)!=-1)
              *(p+k)=*(p+k)+1;
      }

      int count=0;
      for(int i=0;i<n-1;i++)
      {
              if(*(p+i)==n-1)
              {
                             printf("%d",i);
                             count=1;
              }
      }
      if(count==0)
      printf("NOT FOUND");
      free(p);
}


int main()
{
	int n,i,j;
	int know[10000]={0};
	cin>>n;
	for (i=0;i<n;i++)
		know[i]=0;
	while (cin>>i>>j)
	{
		if (i==j&&i==0)
			break;
		know[i]=-1;
		if (know[j]!=-1)
		{
			know[j]++;
			if (know[j]==n-1)
				cout<<j<<endl;
		}
	}
	return 0;
}


main()
{
      int i,j;
      int a,b,c;
      int n;

      scanf("%d",&n);
      int*p=(int*)malloc(n*sizeof(int));
      for(i=0;i<n;i++)
      p[i]=0;
      c=0;
      j=0;

      for(;;)
      {
             scanf("%d %d",&a,&b);
             if(a==0&&b==0) break;
             else
             {
                 if(b==0)
                 j=j+1;
                 else
                 {
                     i=b;
                     p[i]=p[i]+i;
                 }
             }
      }

      if(j==n-1)
      {
                printf("0");
                c=1;
      }
      else
      {
          for(i=1;i<n;i++)
          {
                          if(p[i]/i==(n-1))
                          printf("%d",i);
                          c=c+1;
          }
      }
      if(c=0)
      printf("NOT FOUND");
      getchar();
      getchar();
}


int main(int argc, char* argv[])
{
	int i,j,mingren = 0;
	int count;
	int *person = NULL;
	int num = 0;
	int temp1,temp2;

	scanf("%d", &num);
	count = num;

	int **relation=(int **)malloc(num*sizeof(int *));
	for(i = 0; i < num; i ++)
	{
		relation[i]=(int *)malloc(num * sizeof(int));
	}
	//?????,?????????
	do
	{
		scanf("%d %d", &temp1, &temp2);
		relation[temp1][temp2] = 1;
	} while (temp2 != 0 || temp1 != 0);
	//////////////////////////////////////////////////////////
	temp1 = 0;
	temp2 = 1;
	for (i = 0; i < num-2; i ++)
	{
		if(relation[temp1][temp2] == 1)
		{
			temp1 = num-1-i;
		}
		else
		{
			temp2 = num-1-i;
		}
	}
	if(relation[temp1][temp2] == 1)
	{
		mingren = temp2;
	}
	else
	{
		mingren = temp1;
	}

	for (i = 0; i < num; i ++)//?????????
	{
		if (i != mingren)
		{
			if(relation[i][mingren] == 0 || relation[mingren][i] == 1)
			{
				mingren = -1;
				break;
			}
		}
	}

	///////////////////////////////////////////////////////////

	if (mingren == -1)
	{
		printf("NOT FOUND\n");
	}
	else
	{
		printf("%d\n", mingren);
	}

	for(i = 0; i < num; i ++)
	{
		free(relation[i]);
	}
	free(relation);

	return 0;
}


main()
{
      int n,i;
      scanf("%d",&n);
      int *num=(int*)malloc(n*sizeof(int));
      for(i=0;i<n;i++)
      {
              *(num+i)=0;
      }
      for(;;)
      {
             int a,b;
             scanf("%d %d",&a,&b);
             if(a==0&&b==0) break;
             num[a]--;
             num[b]++;
      }
      for(i=0;i<n;i++)
      {
              if (num[i]==n-1)
              {
                              printf("%d",i);
                              break;
              }
      }
      if(i==n) printf("NOT FOUND");

}


int main()
{
	int n,i,j;
	int flag[10000]={0},num[10000]={0};
	cin>>n;
	while(cin>>i>>j)
	{
		if(i == 0 && j == 0)
			break;
		flag[i] = 1;
		num[j] ++;
	}

	for(i = 0;i < n; i++)
	{
		if(flag[i] == 0)
		{
			if(num[i] == n - 1)
				cout<<i<<endl;
			else
				cout<<"NOT FOUND"<<endl;
			break;
		}

	}
	if(i == n)
		cout<<"NOT FOUND"<<endl;

    return 0;
}


int main()
{
	struct people
	{
		int x,y;
	}
	a[60000];
	int n,i=-1;
	int count=-1;
	int j,k;
	int elite=0;
	int num=0;
	scanf("%d",&n);
	do
	{
		i++;
		count++;
		scanf("%d %d",&a[i].x,&a[i].y);
	}
	while (a[i].x!=0 || a[i].y!=0);
	for (i=0;i<count;i++)
	{
		for (j=0;j<count;j++)
		{
			if (a[j].y==a[i].y)
			{
				num++;
			}
		}
		if (num==n-1)
		{
			for (k=0;k<count;k++)
			{
				if (a[k].x!=a[i].y)
				{
					elite++;
				}
			}
			if (elite==count)
			{
				printf("%d\n",a[i].y);
				return 0;
			}
			else
			{
				elite=0;
				num=0;
			}
		}
		else
		{
			elite=0;
			num=0;
		}
	}
	printf("NOT FOUND\n");
	return 0;
}


int main()
{
    int n,i;
    int a[100000],b[100000];
    scanf("%d",&n);
    for(i=0;;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0&&b[i]==0)
        {
            break;
        }
    }
    int count=0;
    for(int l=0;l<n;l++)
    {
        count=count+l;
    }
    for(int j=0;j<n;j++)
    {
        int count1=0,count2=0;
        for(int k=0;k<i;k++)
        {
            if(a[k]==j)
            {
                count1++;
            }
            if(b[k]==j)
            {
                count2=count2+a[k];
            }
        }
        if(count1==0&&count2==count-j)
        {
            printf("%d\n",j);
        }
    }
    return 0;
}


int main()
{
  int n,a,b;
  struct p
  {
      int k;
      int count;
  }p[10000];
  cin>>n>>a>>b;
  for(int i=0;i<n;i++)
	  p[i].count=0;
  while(!(a==0 && b==0))
  {
      p[b].count++;
      cin>>a>>b;
  }
  for(int i=0;i<n;i++)
	  if(p[i].count == n-1)
	  {
		  cout<<i;
          return 0;
      }
  cout<<"NOT FOUND";
}


int c;
int main()
{
    int *p,*q,*z;
    int n,i,j,sum=0,d,m=0;
    scanf("%d",&n);
    p=(int*)malloc(10*n*sizeof(int));
    q=(int*)malloc(10*n*sizeof(int));
    z=(int*)malloc(10*n*sizeof(int));
    for(i=0;;i++)
    {
        scanf("%d %d",&p[i],&q[i]);
        if(p[i]==0&&q[i]==0)
        break;

    }
    sum=i;
    for(i=0;i<n;i++)
    z[i]=i;
    for(i=0;i<n;i++)
    {
        d=0;
        for(j=0;j<sum;j++)
        {
            if(z[i]==p[j])
            break;
            else if(z[i]==q[j])
            d=d+1;
        }

        if(d==(n-1))
        {
            printf("%d",z[i]);
        }
        else
        {
            m=m+1;
        }

    }

}


main()
{
      int n,i;
      scanf("%d",&n);
      int *num=(int*)malloc(n*sizeof(int));
      for(i=0;i<n;i++)
      {
              *(num+i)=0;
      }
      for(;;)
      {
             int a,b;
             scanf("%d %d",&a,&b);
             if(a==0&&b==0) break;
             num[a]--;
             num[b]++;
      }
      for(i=0;i<n;i++)
      {
              if (num[i]==n-1)
              {
                              printf("%d",i);
                              break;
              }
      }
      if(i==n) printf("NOT FOUND");
      getchar();getchar();getchar();
}


main()
{
      int n,m;
      scanf("%d",&n);
      int i,j;

      int* p=(int*)malloc(n*sizeof(int));
      int* q=(int*)malloc(n*sizeof(int));
       for(m=0;m<n;m++)
      {p[m]=0;q[m]=0;}

      for(;;)
      {
               scanf("%d %d",&i,&j);
             if(i==0&&j==0) break;
             else
             {
              p[j]++;q[i]++;
             }
      }

       int h=0;
      for(m=0;m<n;m++)
      {
         if(p[m]==(n-1)&&q[m]==0)
         printf("%d",m);
         else h++;
      }
      if(h==n)
      printf("NOT FOUND");
      getchar();
      getchar();

}


int a[10000][10000];

int main()
{
	int i,j,n,flag=1;
	cin>>n;
	while(cin>>i>>j)
	{
		if (i==0 && j==0)	break;
		a[i][j]=1;
	}
	i=0;
	j=1;
	while(j<n)
	{
		if (a[i][j]==0)	j++;
		else	{
			i=j;
			j++;
		}
	}
	for (j=0;j<n;j++)
	{
		if (i==j)	continue;
		if (a[i][j]==1 || a[j][i]==0) {
			flag=0;
			break;
		}
	}
	if (flag==0)	cout<<"NOT FOUND"<<endl;
	else cout<<i<<endl;
	return 0;
}


/**
* @file homework.cpp
* @author ???
* @date 2010-12-9
* @description
* ??????: ??????
*/
int main()
{
    int n, a, b, i;
    cin >> n;
    int num[100000];
    int *p = num;
    while(cin)
    {
        cin >> a >> b;
        if(a == 0 && b == 0)
        {
            break;
        }
        else
        {
            *(p + b) = *(p + b) + 1;
        }
    }
    for(p = num;p < num + n;p++)
    {
        if(*p == n - 1)
        {
            cout << p - num;
            break;
        }
        if(p == num + n - 1)
        {
            cout << "NOT FOUND";
        }
    }

    return 0;
}


int main()
{
	int n,i,j,bmax,max,b[10000]={0},count[10000]={0};
	cin>>n;
	while(1)
	{
		cin>>i>>j;
		if(i==0&&j==0)
			break;
		b[j]++;
		count[i]++;
	}
	bmax=b[0];
	max=0;
	for(int k=1;k<n;k++)
		if(b[k]>bmax)
		{
			bmax=b[k];
			max=k;
		}
	if(count[max]==0)
		cout<<max<<endl;
	else
		cout<<"NOT FOUND"<<endl;
	return 0;
}


const	int	maxn = 1000000+10;

int		know[maxn], known[maxn];
int		n, a, b, i;

int	main()
{
	scanf("%d", &n);
	memset(know, 0, sizeof(know));
	memset(known, 0, sizeof(known));
	while (scanf("%d%d", &a, &b) && (a+b != 0))
	{
		know[a] ++;
		known[b] ++;
	}
	for (i = 0; i < n; i++)
	if (known[i] == n-1 && know[i] == 0)
		cout << i << endl;

	return 0;
}


int main ()
{
    int *p;
    int n,i,t,x,y;
    scanf("%d",&n);
    p=(int*)malloc(n*sizeof(int));
    for(i=0;i<n;i++)
        p[i]=0;
    scanf("%d %d",&x,&y);
    while(x!=0||y!=0)
    {
        if (x!=y)
        {p[x]--;
        p[y]++;}
        scanf("%d %d",&x,&y);
    }
    t=1;
    for(i=0;i<n;i++) if(p[i]==n-1)
    {
        printf("%d",i);
        t=0;
        break;
    }
    if (t) printf("NOT FOUND");
    free(p);
}


main()
{
    int n,a,b,i,ncount;
    int they[10000]={0},me[10000]={0};
    scanf("%d",&n);
    for(i=0;;i++)
    {
        scanf("%d",&a);
        scanf("%d",&b);
        if(a==0&&b==0)
            break;
        else
        {
            they[a]++;
            me[b]++;
        }
    }
    ncount=0;
    for(i=0;i<n;i++)
    {
        if(they[i]==0&&me[i]==n-1)
        {
            printf("%d\n",i);
            ncount++;
        }
    }
    if(ncount==0)
    printf("NOT FOUND");
    getchar();
    getchar();
}


int main()
{
    int n,j,k,count=0,l,i;
    scanf("%d",&n);
    int *a=(int *)malloc(n*n*sizeof(int));
    int *b=(int *)malloc(n*n*sizeof(int));
    for(i=0;i<=n*n-1;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0&&b[i]==0)
        {
            break;
        }
        count++;
    }
    int *c=(int *)malloc(n*sizeof(int));
    for(l=0;l<=n-1;l++)
    {
        c[l]=1;
    }
    for(j=0;j<=count-1;j++)
    {
        c[b[j]]++;
    }
    for(k=0;k<=n-1;k++)
    {
        if(c[k]==n)
        {
            printf("%d",k);
            break;
        }
    }
    if(k==n)
    {
        printf("Not Found!");
    }
    free(a);
    free(b);
}


int main()
{
	int i,j,m,n,k; cin>>k;
	int a[k],b[k];
	for (m=0;m<k;m++)
	{a[m]=0; b[m]=0;}
	while (true)
	{
		cin>>i>>j;
		if (i==0&&j==0) break;
		else {a[i]+=1; b[j]+=1;}
	}
	for (n=0;n<k;n++)
		if (a[n]==0&&b[n]==k-1)
			{cout<<n<<endl;break;}
	if (n==k) cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
	int n = 0, a = 0, b = 0, i = 0, pos = 0, count[10000], num = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i ++)
		count[i] = 0;

	while (scanf("%d%d", &a, &b) && (a + b != 0))
		count[b] ++;

	for (i = 0; i < n; i ++)
	{
		if (count[i] == n -1)
		{
			pos = i;
			num ++;
		}
	}

	if (num == 1)    printf("%d\n", pos);
	else    printf("NOT FOUND\n");

	return 0;
}


int main()
{
    int meet[100000];
    int i, j, n, a, b;

    scanf( "%d", &n );
    memset( meet, 0, n * sizeof(int) );
    for( scanf("%d%d",&a,&b); a + b; scanf("%d%d",&a,&b) )
        meet[b]++;

    for( i = 0; i < n; i++ )
        if( meet[i] == n -1 )
            break;

    if( i == n )
        printf( "NOT FOUND" );
    else printf( "%d\n", i );

    return 0;
}


/*
 * shehuimingliu.cpp
 *
 *  Created on: 2011-1-8
 *      Author: lz
 */

int people[20000][20000];
int main()
{
	int n;
	cin>>n;
	int a;
	int b;

	int i;
	int j;
	cin>>a>>b;
	while(a!=0||b!=0)
	{
		people[a][b]=1;
		cin>>a>>b;
	}
	for(j=0;j<n;j++)
	{
		for(i=0;i<n;i++)
		{
			if(i!=j)
			    if(people[i][j]==1&&people[j][i]==0)
				    continue;
			    else
				    break;
		}
		if(i==n)
		{
			cout<<j;
			break;
		}
	}
	if(j==n)
	{
		cout<<"NOT FOUND";
	}
	return 0;
}


int main(){
	int i,j,n,in[MAXN]={0},ou[MAXN]={0};
	for (scanf("%d%d%d",&n,&i,&j);i+j>0;scanf("%d%d",&i,&j)){
		in[i]++;
		ou[j]++;
	}
	for (i=0;i<n;i++)
		if (in[i]==0&&ou[i]==n-1){ printf("%d\n",i);return 0;}
		printf("NOT FOUND\n");
	return 0;

}


int main()
{
	int i,m,j,n,flag=0;
	int *p,*q;
    scanf("%d",&n);
    p=(int*)malloc(sizeof(int)*(n+1));
    q=(int*)malloc(sizeof(int)*(n+1));
    memset(p,0,sizeof(p));
    memset(q,0,sizeof(q));
    for(;;){
    scanf("%d%d",&i,&j);
        if(i==0&&j==0){
        	break;
        }
        else{
    	p[i]=1;
    	q[j]++;
        }
    }
    for(i=0;i<n;i++){
   	   if(p[i]==0&&q[i]==n-1){
	   printf("%d\n",i);
	   flag=1;
   	   }
    }
	if(flag==0)
     printf("NOT FOUND");
}


int main ()
{
	int n, know[10000] = {0}, known[10000] = {0},
	    flag, man, man0;
	cin >> n;
	do
	{
		cin >> man >> man0;
		if (man == 0 && man0 == 0) break;
		++know[man];
		++known[man0];
	} while(1);
	flag = 0;
	for (int i = 0; i < n; i++)
		if (know[i] == 0 && known != 0)
		{
			cout << i << endl;
			++flag;
		}
	if (flag == 0)
		cout << "NOT FOUND" << endl;
	getchar();
	getchar();
	return 0;
}


int main()
{
	struct person
	{
		int rs;
		int brs;
	}p[10000];

	int n;
	int i,j,k,l,m,q;
	cin>>n;
	int t1=0,t2=1;
	for(i=0;t1!=t2;i++)
	{
		cin>>t1>>t2;
		p[i].rs=t1;
		p[i].brs=t2;
	}

	int flag,out=0;
	int record[10000];
	for(j=0;j<=n-1;j++)
	{
		flag=1;
		for(k=0;k<=i-2;k++)
		{
			if(p[k].rs==j)
			{
				flag=0;
				break;
			}
		}
		if(flag==0)
			continue;
		for(q=0;q<=n-1;q++)
		{
			record[q]=0;
		}
		for(l=0;l<=i-2;l++)
		{
			if(p[l].brs==j)
			{
				record[p[l].rs]=1;
			}
		}

		for(m=0;m<=n-1;m++)
		{
			if(m==j)
				break;
			if(record[m]==0)
			{
				flag=0;
				break;
			}
		}
		if(flag==1)
		{
			cout<<j<<endl;
			out=1;
		}
	}
	if(out==0)
		cout<<"NOT FOUND"<<endl;

	return 0;
}


int main()
{
	int n = 0;
	int num1[100000];
	int num2[100000];
	int flag[100000];
	int except[100000];
	int i = 0;
	int j = 0;
	int p = 0;
	int sum = 0;
	int f = 0;

	memset(num1,0,sizeof(num1));
	memset(num2,0,sizeof(num2));
	memset(flag,0,sizeof(flag));
	memset(except,0,sizeof(except));

	cin >> n;
	while (1)
	{
		cin >> num1[i] >> num2[i];
		except[num1[i]]++;
		if ((num1[i] == 0) && (num2[i] == 0))
			break;
		i++;
	}

	for (j = 0; j < n; j++)
	{
		if (except[j] != 0)
			continue;
		sum = 0;
		memset(flag,0,sizeof(flag));
		for (p = 0; p < i; p++)
		{
			if (num2[p] == j)
				if (flag[num1[p]] == 0)
					flag[num1[p]]++;
			if (num1[p] == j)
				flag[num1[p]] = -1;
		}
		for (p = 0; p < n; p++)
			sum += flag[p];
		if (sum == n - 1)
		{
			cout << j;
			f = 1;
		}
	}
	if (f == 0)
		cout << "NOT FOUND";

	return 0;
}


int data[100000];
int main()
{
	int n,x,y;
	scanf("%d",&n);
	while(1)
	{
		scanf("%d%d",&x,&y);
		if(x+y==0)break;
		data[x]=-1;
		if(data[y]>=0)data[y]++;
	}
	int i=n;
	while(n-->=0)if(data[n]==i-1){printf("%d\n",n);break;}
	if(n<0)printf("NOT FOUND\n");
	return 0;
}


int main()
{
	int n;
	int a, b;
	int num[100000];
	cin>>n;
	memset(num,0,sizeof(num));
	while( cin>>a>>b && !( a == 0 && b == 0 ) )
	{
		num[b]++;
	}
	for( int i = 0 ; i < n ; i ++ )
	{
		if( num[i] == n - 1 ) { cout<<i<<endl; return 0; }
	}
	cout<<"NOT FOUND"<<endl;
	return 0;

}


int main()
{
	int n;
	scanf("%d",&n);
	int *p=(int *)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++)
		p[i]=1;
	int *q=(int *)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++)
		q[i]=-1;
	int m;
	scanf("%d",&m);
	scanf("%d",&q[m]);
	while(q[m]!=0||m!=0)
		{
		p[m]=0;
		scanf("%d",&m);
		scanf("%d",&q[m]);
		}
	int judge=0;
	for(int i=0;i<n;i++)
		if(p[i]==1)
			{
			printf("%d",i);
			judge=1;
			}
	if(judge==0)
		printf("NOT FOUND");

}


int main ()
{
int n, i = 0,j, flag = 0, tempa,tempb;
int a[100000] = {0}, b[100000] = {0};

cin >> n;
while(cin >> tempa >> tempb)
{
if(tempa == 0 && tempb == 0)
break;
b[tempb] ++;

}
for(i = 0;i < n;i ++)
{
if( b[i] == n - 1)
cout << i << endl;
flag = 1;
}
if(flag == 0)
cout << "NOT FOUND" << endl;
return 0;
}


main()
{
      int n,i,j,k;
      int count=0;
      scanf("%d",&n);
      int*p=(int*)malloc(sizeof(int)*n*n);
      for(i=0;i<n*n;i++)
      {p[i]=0;}
      for(i=0;i<n;i++)
      {p[i*n+i]=1;}
      for(i=0;;i++)
      {
                   scanf("%d %d",&k,&j);
                   if(j==0&&k==0)
                   {break;}
                   else
                   {
                       p[j*n+k]=1;
                   }
      }
      for(j=0;j<n;j++)
      {
           for(k=0;k<n;k++)
           {
               if(p[j*n+k]==0)
               break;
           }
           if(k==n)
           {
                printf("%d\n",j);
                count++;
           }
      }
      if(count==0)
      {printf("NOT FOUND\n");}
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}


struct person
{
	int kn;
	int bkn;
};
main()
{
	int n,a,b,i,s=0;
	struct person *p;
	scanf("%d",&n);
	p=(struct person *)malloc(n*sizeof(struct person));
	for (i=0;i<n;i++)
	{
		p[i].kn=0;
		p[i].bkn=0;
	}
	while (1)
	{
		scanf("%d %d",&a,&b);
		if (a==0 && b==0)
			break;
		p[a].kn++;
		p[b].bkn++;
	}
	for (i=0;i<n;i++)
	{
	    if (p[i].kn==0 && p[i].bkn==n-1)
	        {
			printf("%d\n",i);
			s++;
            }
	}
	if(s==0) printf("NOT FOUND");
	free(p);
}


struct ming
{
       int n;
       int m;
       struct ming *next;
};

struct ming*creat()
{
       struct ming *head,*p1,*p2;
       int i=0;
       p1=p2=(struct ming*)malloc(LEN);
       scanf("%d%d",&p1->n,&p1->m);
       head=NULL;
       while(p1->n!=0||p1->m!=0)
       {
                                i++;
                                if(i==1){head=p1;}
                                else
                                p2->next=p1;
                                p2=p1;
                                p1=(struct ming*)malloc(LEN);
                                scanf("%d%d",&p1->n,&p1->m);
                                //printf("%d %d\n",p1->n,p1->m);
       }
       p2->next=NULL;
       return(head);
}
int found(int l,struct ming*head)
{
    int i=0;
    struct ming *p1;
    p1=head;
    while(p1!=NULL)
    {
                         if(p1->m==l)
                         {i++;
                         //printf("%d\n",p1->n);
                         }
                         p1=p1->next;
                         //printf("%d %d\n",p1->n,p1->m);
    }
    return(i);
}

int main()
{

    int n,o,k,p;
    scanf("%d",&n);
    struct ming *head;
    head=creat();
    for(o=0,k=0;o<n;o++)
    {
                    p=found(o,head);
                    //printf("%d\n",p);
                    if(p==n-1)
                    {
                            printf("%d\n",o);
                            k++;
                            break;}
    }
    if(k==0)printf("NOT FOUND");
    getchar();
    getchar();
    getchar();
}


/*
 * shehuimingliu.cpp
 *
 *  Created on: 2011-1-8
 *      Author: Owner
 */
int a[1000000];
int b[1000000];

int main()
{
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	int n;
	int i;
	int j;
	int x,y;
	cin>>n;
	for(i=1;i<=n*(n-1);i++)
	{

		cin>>x>>y;
		if((x==0)&&(y==0))  break;
		a[y]++;
		b[x]++;
	}
	for(j=0;j<n;j++)
	{
		if((a[j]==n-1)&&(b[j]==0))
			{cout<<j<<endl;
			break;
			}

		else
		{
			if(j==n-1)
				cout<<"NOT FOUND"<<endl;

		}
	}
}


struct shehui
{
	int x;
}a[10000];
int main()
{
	int n, i, j, count = 0;
	cin >> n;
	do
	{
		cin >> i >> j;
		a[j].x++;
	}while (i != 0 || j != 0);
	for (i = 0; i < n; i++)
	{
		if (a[i].x == n - 1)
		{
			count++;
			cout << i << endl;
		}
	}
	if (count == 0)
		cout << "NOT FOUND" << endl;
	return 0;
}


int outd[100000],ind[100000];
int main(){
    int n,a,b;
    scanf("%d",&n);
    memset(outd,0,sizeof(outd));
    memset(ind,0,sizeof(ind));
    while(scanf("%d%d",&a,&b)!=EOF){
        if(a==0&&b==0)break;
        outd[a]++,ind[b]++;
    }
    int flag=0;
    for(int i=0;i<n;i++)
        if(ind[i]==n-1&&outd[i]==0){
            cout<<i<<endl;
            flag=1;
        }
    if(!flag)
        cout<<"NOT FOUND"<<endl;
    return(0);
}


main()
{
     int n,k;
     scanf("%d",&n);
     int*p=(int*)malloc(n*sizeof(int));
     for(int i=0;i<n;i++)
          p[i]=0;
     for(;;)
     {
          int i,j;
          scanf("%d",&i);
          scanf("%d",&j);
          if(i==0&&j==0)
          break;
          p[j]=p[j]+1;
     }
     for(k=0;k<n;k++)
     {
          if(p[k]==n-1)
          {
               printf("%d\n",k);
               break;
          }
     }
     if(k==n)
     printf("NOT FOUND\n");
     free(p);
     return 0;
}


int a[10000] = {0};

int main()
{
    int n;
    int i;
    int from;
    int to;
    scanf("%d", &n);
    while (scanf("%d %d", &from, &to) && (from || to)) {
        a[from] = -1;
        if (a[to] != -1) {
            a[to] += 1;
        }
    }
    for (i = 0; i < n; i++) {
        if (a[i] == n - 1) {
            printf("%d\n", i);
            break;
        }
    }
    if (i == n) {
        printf("NOT FOUND\n");
    }
    return 0;
}


int main()
{
    int n,i,j,p,q,sus,num;
    num=0;
    scanf("%d",&n);
    int *k=(int *)malloc(n*sizeof(int));
    for(i=0;i<n;i++)
    k[i]=i;
    scanf("%d %d",&p,&q);
    while(p!=0||q!=0)
    {
                    k[p]=-1;
                    scanf("%d %d",&p,&q);
    }
    for(i=0;i<n;i++)
    {
        if(k[i]!=-1)
        {
         sus=k[i];
         break;
        }
        else
        num=num+1;
    }
    if(num==n)
    printf("NOT FOUND");
    else
    printf("%d",sus);
    getchar();
    getchar();
}


int main()
{
 	int n,row,col,i,num,x;
 	int sz[1000000][2],brs[10000],rs[10000];
 	scanf("%d",&n);
 	for(row=0;row<n*n;row++){
			for(col=0;col<2;col++){
				scanf("%d",&sz[row][col]);
				}
			if(sz[row][0]==0&&sz[row][1]==0) break;
			}
	x=row;
	for(i=0;i<n;i++){
		num=0;
		for(row=0;row<=x;row++){
			if(sz[row][1]==i) num++;
			}
		brs[i]=num;
		}
	for(i=0;i<n;i++){
		num=0;
		for(row=0;row<=x;row++){
			if(sz[row][0]==i) num++;
			}
		rs[i]=num;
		}
	num=0;
	for(i=0;i<n;i++){
		if(brs[i]==n-1&&rs[i]==0){
			printf("%d",i);
			}
		else num++;
		}
	if(num==n) printf("NOT FOUND");

    return 0;
}


int main()
{
	int n, a, b, i, f = 1;

	typedef struct P
	{
		int known;
		int know;
	}peo;
	peo * p;
	scanf("%d", & n);
	p = (peo *)malloc(sizeof(peo) * n);

	for(i = 0; i < n; i++)
	{
		p[i].know = 0;
		p[i].known = 0;
	}

	scanf("%d%d", & a, & b);
	for(; ! (a == 0 && b == 0); )
	{
		p[a].know++;
		p[b].known++;
		scanf("%d%d", & a, & b);
	}
	for(i = 0; i < n; i++)
	{
		if((p[i].know < n - 1) && (p[i].known == n - 1))
		{
			f = 0;
			printf("%d",i);
		}
	}
	if(f)
		printf("NOT FOUND\n");
}


int main()
{
	int n, i, j, k;
	int *p1,*p2;
	int flag=0;
	int person[10000] = {0},count[10000] = {0};
	cin >> n;
	cin >> i >> j;
	p1 = &person[j];
	p2 = &count[i];
	while(i!=0||j!=0)
	{
		(*p1)++;
		count[i]++;
		cin >> i >> j;
		p1 = &person[j];
	    p2 = &count[i];

	}

	for(k=0;k<n;k++)
		if(person[k]==n-1&&count[k]==0)
		{
			cout << k << endl;
			flag = 1;
		}
	if(flag==0)
		cout << "NOT FOUND" << endl;

	return 0;
}


main()
{
      int n,a,b,i,k;
      int *p=(int*)malloc(n*sizeof(int));
      int *q=(int*)malloc(n*sizeof(int));
      scanf("%d",&n);
      for(i=0;i<n;i++)
         {
          p[i]=0;
         q[i]=0;
         }
      for(k=0;;k++)
      {
         scanf("%d %d",&a,&b);
         if(a==0&&b==0)
         break;
         for(i=0;i<n;i++)
         {

            if(a==i)
            {p[i]=p[i]+1;}
            if(b==i)
            {q[i]=q[i]+1;}
         }
      }
       for(i=0;i<n;i++)
         {
            if(p[i]==0&&q[i]==n-1)
            {printf("%d",i);
            break;}
            }
        if(i==n)
            {printf("NOT FOUND");
            }

   getchar();
      getchar();
      getchar();
      getchar();
}


int main()
{
    int i=0,j,n,judge=0;
    cin>>n;
    int peo1[n],peo2[n];
    int countNum[n];
    for(i=0;i<n;i++)
    {
        countNum[i]=0;
    }
    while(1)
    {
        cin>>peo1[i]>>peo2[i];
        if(peo1[i]==0&&peo2[i]==0)  break;
        else    countNum[peo2[i]]++;
    }
    for(i=0;i<n;i++)
    {
        if(countNum[i]==n-1)
        {
            cout<<i<<endl;
            judge=1;
        }
    }
    if(judge==0) cout<<"NOT FOUND";
    return 0;
}


main()
{
      int n,*p,i,j,a,b;
      scanf("%d",&n);
      p=(int *)malloc(n*sizeof(int));
      for(i=0;i<n;i++) p[i]=0;
      scanf("%d%d",&a,&b);
      while(a!=0 || b!=0)
      {
            p[b]++;
            scanf("%d%d",&a,&b);
      }
      for(i=0;i<n;i++) if(p[i]==n-1) {printf("%d",i);break;}
      if(i==n) printf("NOT FOUND");
}


int main()
{
	int people[100000] = {0};
	int n , num1 , num2 ,flag = 0;
	cin>>n;
	for( ;; )
	{
		cin>>num1>>num2;
		if( num1 == 0 && num2 == 0)
		{
			for( int i = 0 ; i < n ; i++)
	        {
		       if( people[i] == n - 1)
		       {
			       flag = 1;
			       cout<<i<<endl;
		       }
	        }
	        if( flag == 0)
	        {
		         cout<<"NOT FOUND"<<endl;
	        }
			return 0;
		}
		else
		{
			people[num2]++;
		}
	}

}


int main()
{
	int i,a,b,n;
	int TRUE=1;
	int left[10000]={0};
	int right[10000]={0};
	scanf("%d",&n);
	while(TRUE)
    {
		scanf("%d%d",&a,&b);
		left[a]++;
		right[b]++;
		if(a==0&&b==0)      break;
	}
    left[0]=left[0]-1;
    right[0]=right[0]-1;
	for(i=0;i<n;i++)
    {
		if(right[i]==n-1&&left[i]==0)
        {
			printf("%d\n",i);
			TRUE=0;
		}
	}
	if(TRUE)   printf("NOT FOUND\n");
	return 0;
}


int main()
{
	int num;
	int i,j;
	int* relation;
	scanf("%d",&num);
	relation = (int*)malloc(sizeof(int)*num*num);
	assert(relation!=NULL);

	memset(relation,0,num*num*sizeof(int));

	i=1;
	j=1;

	while(!(i==0&&j==0))
	{
		scanf("%d %d", &i, &j);
		relation[j*num+i] = 1;
	}

	j=0;
	for (i=1;i<num;i++)
	{
		if (!relation[j*num+i])
			j = i;
	}

	for ( i=0;i<num;i++)
	{
		if ( i!=j )
			if (!relation[j*num+i])
			{
				printf("NOT FOUND");
				return 0;
			}
	}

	printf("%d",j);
	return 0;

}


int main()
{
	int n, x, y, j, flag;
	int know[10000], beknown[10000];
	while(cin>>n)
	{
		memset(know, 0, sizeof(know));
		memset(beknown, 0, sizeof(beknown));
		while(1)
		{
			cin>>x>>y;
			if(x==0 && y==0)
				break;
			know[x]++;
			beknown[y]++;
		}
		flag = false;
		for(j=0; j<n; j++)
			if(know[j]==0 && beknown[j]==n-1)                       //????????????
			{
				flag = true;
				cout<<j<<endl;
			}
		if(!flag)
			cout<<"NOT FOUND"<<endl;
	}
	return 0;
}


int main()
{
	int n,i,j,k,g=0;
	int a[10000]={0};
	cin>>n;
	while(cin>>i>>j)
	{
		if(i==0&&j==0)
			break;
		else
			a[j]++;
	}
	for(k=0;k<n;k++)
	{
		if(a[k]==n-1)
		{
			cout<<k<<endl;
		    g=1;
		}
	}
	if(g==0)
		cout<<"NOT FOUND";
	return 0;
}


int know(int **a, int n, int i, int j)
{
	return (a[(i%n)>>5][j%n] & (1<<((i%n)&0x1f))) ? 1 : 0;
}

void set(int **a, int n, int i, int j)
{
	a[(i%n)>>5][j%n] |= 1<<((i%n)&0x1f);
}

int ** read_data(int n)
{
	int i, j;
	int **a = (int **)malloc(n * sizeof(int *) / 32);
	for (i = 0; i < n / 32; i++)
	{
		a[i] = (int *)malloc(n * sizeof(int));
		memset(a[i], 0, (n * sizeof(int)));
	}
	for (;;)
	{
		scanf("%d%d", &i, &j);
		if (i == 0 && j == 0)
			break;
		set(a, n, i, j);
	}
	return a;
}

void free_data(int **a, int n)
{
	int i;
	for (i = 0; i < n / 32; i++)
	{
		free(a[i]);
	}
	free(a);
}

int main()
{
	int i, j, n, next, k, wrong, candidate;
	scanf("%d", &n);
	int **a = read_data(n);
	/*
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			printf("%d", know(a, n, i, j));
		}
		printf("\n");
	}
	*/
	// begin
	i = 0;
	j = 1;
	next = 2;
	while (next <= n)
	{
		if (know(a, n, i, j))
			i = next;
		else
			j = next;
		next++;
	}
	if (i == n)
		candidate = j;
	else
		candidate = i;
	wrong = 0;
	k = 0;
	while ( !wrong && k < n )
	{
		if (know(a, n, candidate, k) && (candidate != k))
			wrong = 1;
		if (!know(a, n, k, candidate) && (candidate != k))
			wrong = 1;
		k++;
	}
	if (!wrong)
		printf("%d", candidate);
	else
		printf("NOT FOUND");
	// end
	free_data(a, n);
	return 0;
}


int main()
{
	int n;
	int in[200000],out[200000];
	memset(in,0,sizeof(int));
	memset(out,0,sizeof(int));
	cin>>n;
	int to,from;
	while(cin>>to>>from)
	{
		if(to == 0 && from == 0) break;
		in[from] ++;
		out[to] ++;
	}
	for(int i = 0 ; i < n; i ++)
	{
		if(in[i] == n - 1 && out[i] == 0)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<"NOT FOUND"<<endl;
	return 0;
}


int main(){
	int n;
	cin>>n;
	int rela1[100000],rela2[100000];
	int i=0,p,I;
	while(1){
		cin>>rela1[i]>>rela2[i++];
		if(rela1[i-1]==0&&rela2[i-1]==0){
			I=i;
			break;
		}}
		int num[n];
		for(p=0;p<n;p++){
			num[p]=0;
			for(int k=0;k<I-1;k++)
				if(rela2[k]==p)num[p]++;
			if(num[p]>=n-1){
				cout<<p<<endl;
				break;
			}
		}
		if(p==n)cout<<"NOT FOUND"<<endl;
	return 0;
}


/*
 * 243.cpp
 *
 *  Created on: 2011-12-22
 *      Author: think
 */
int main(){
	int n;
	cin>>n;
	int knowcount[n];
	int knowncount[n];
	memset(knowcount,0,sizeof(knowcount));
	memset(knowncount,0,sizeof(knowncount));
	int temp1,temp2;
	for(;;){
		cin>>temp1>>temp2;
		if(temp1==0&&temp2==0)break;
		knowcount[temp1]++;
		knowncount[temp2]++;
	}
	int i,count=0;
	for(i=0;i<n;i++){
		if(knowcount[i]==0&&knowncount[i]==n-1){
			cout<<i<<endl;count++;
		}
	}
	if(count==0)cout<<"NOT FOUND"<<endl;
	return 0;
}


/*
 * 111220_Celebrity.cpp
 *
 *  Created on: 2011-12-23
 *      Author: Alfalfa
 */
int main(){
	int n1;
	cin>>n1;
	const int n=n1;
	int knowother[n],beknown[n],input1=1,input2=1;
	memset(knowother,0,sizeof(knowother));
	memset(beknown,0,sizeof(beknown));
	while(input1||input2){
		cin>>input1>>input2;
		if(input1!=input2) {
			knowother[input1]++;
			beknown[input2]++;
		}
	}
	int celebrity=0,flag=0;
	for(int i=0;i<n;i++){
		if(knowother[i]==0 && beknown[i]==n-1) {
			celebrity=i;
			flag=1;
		}
	}
	if(flag==1) cout<<celebrity;
	else cout<<"NOT FOUND";
	return 0;
}


int n ;
int i , j;
int in[ 10000] = { 0 } ;
int out[ 10000 ] = { 0 };

int main()
{
	int h ;
	cin>>n ;
	while( cin>>i>>j )
	{
		if( i == 0 && j == 0 )
			break;

		in[ i ] = 1 ;
		out[ j ] = 1 ;
	}

	for( h = 0 ; h < n ; h++ )
	{
		if( in [ h ] == 1 )
		{
			out[ h ] = 0 ;
		}
	}

	int count = 0 ;

	for( h = 0 ; h < n ; h++ )
	{
		if( out[ h ] == 1 )
		{
			cout<<h<<endl ;
			count = 1 ;
		}
	}

	if( count == 0 )
	{
		cout<<"NOT FOUND"<<endl;
	}

	return 0 ;

}


struct person
{
	int flag;
	int count;
}p[10001];

int main()
{
	int n, i, j, g = 0;
	cin >> n;
	while (1)
	{
		cin >> i >> j;
		if (i == 0 && j == 0) break;
		p[i].flag = 1;
		p[j].count++;
	}
	for (int i = 0; i < n; i++)
	{
		if (p[i].flag == 0 && p[i].count == n - 1) g = 1, cout << i << endl;
	}
	if (g == 0) cout << "NOT FOUND" << endl;
	return 0;
}


int main()
{
	int c[10000], n, a, b, answer = 20000;
	memset(c, 0, 100);
	cin >> n;
	while (cin >> a >> b && (a + b!=0))
	{
		c[a] = 1;
	}
	for (int i = 0; i < n; i ++)
	{
		if(c[i] == 0)
		{
			answer = i;
		}
	}
	if (answer != 20000)
	{
		cout << answer << endl;
	}
	else
	{
		cout << "NOT FOUND" << endl;
	}
	return 0;
}


int main(int argc, char * argv[])
{
    int person[10000];
    int number,a,b,i;
    cin >> number;

    for(i=0;i<number;i++)
        person[i]=0;

    for(i=0;;i++)
  {
    cin >> a >> b;
    if(a==0 && b==0) break;
    person[a]=-1;
    if(person[b]!=-1)person[b]++;
  }

    for(i=0;i<number;i++)
  {
      if(person[i]==number-1)
      {  cout <<i<< endl;
         break;
      }
  }
    if(i==number)
        cout <<"NOT FOUND"<< endl;
    return 0;
}


int main()
{
	int n,know,a,b,c=0;
	scanf("%d",&n);
	int *p= (int*)malloc(n*sizeof(int)) ;
	int *q= (int*)malloc(n*sizeof(int)) ;
	for(int i=0;i<n;i++)
	{
		q[i]=0;p[i]=0;
	}
	while(1)
	{
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)
			break;
		q[b]=q[b]+1;
		p[a]=1;
	}
	for(int i=0;i<n;i++)
		if(p[i]==0 && q[i]==n-1)
		{
			printf("%d",i);
			c=1;
		}
		if(c==0)
	printf("NOT FOUND");
	return 0;
}


int inDegree[10000];
int outDegree[10000];

int main()
{
	int N;
	cin>>N;
	memset(inDegree,0,sizeof(inDegree));
	memset(outDegree,0,sizeof(outDegree));
	int first,second;
	while(cin>>first>>second)
	{
		if(first==0&&second==0)
			break;
		outDegree[first]++;
		inDegree[second]++;
	}
	int i;
	for(i=0;i<N;i++)
	{
		if(outDegree[i]==0&&inDegree[i]==N-1)
			break;
	}
	if(i==N)
		cout<<"NOT FOUND\n";
	else
		cout<<i<<endl;
	return 0;
}


int n,a,b,ind[MAXN],oud[MAXN],i;
int main()
{
  scanf("%d",&n);
  scanf("%d%d",&a,&b);
  while(a+b)
    {
    ind[b]++;
    oud[a]++;
    scanf("%d%d",&a,&b);
    }
  for(i=0;i<n;i++)
    if (ind[i]==n-1&&!oud[i])
      break;
  if (i<n)
    printf("%d\n",i);
  else
    printf("NOT FOUND\n");
  return 0;
}


int a[10001]={0};
int main(){
	int n,tag,i,j;
	scanf("%d",&n);
	while(1){
		scanf("%d%d",&i,&j);
		if(!(i||j)) break;
		a[i]=1;
	}
	for(int i=0;i<n;i++)
		if(!a[i]){
			printf("%d\n",i);
			return 0;
		}
	printf("NOT FOUND\n");
	/*
	for(int i=0;i<n;i++){
		tag=1;
		for(int j=0;j<n;j++){
			if(i==j) continue;
			if(a[i][j] || !(a[j][i]) ) {
				tag=0;
				break;
			}
		}
		if(tag==1){
			printf("%d\n",i);
			return 0;
		}
	}
	printf("NOT FOUND\n");*/

}


int main()
{
	int n, i, j, a[100000]={0}, flag = 0;
	cin >> n;
	cin >> i >> j;
	while(i+j)
	{
		a[j]++;
		cin >> i >> j;
	}
	for(i=0;i<n;i++)
	{
		if(a[i]==n-1)
		{
			cout << i << endl;
			flag = 1;
		}
	}
	if(flag == 0)
		cout << "NOT FOUND";
	return 0;

}


struct man
{
	int a;
	int b;
}person[10000];
int main()
{
	int n=0;
	int x=0,y=0;
	int i=0;
	cin>>n;
	while(1)
	{
		cin>>x>>y;
		if(x==0&&y==0)
			break;
		person[x].a++;
		person[y].b++;
	}
	for(i;i<n;i++)
	{
		if(person[i].a==0&&person[i].b==n-1)
		{
			printf("%d\n",i);
			break;
		}
	}
	if(i==n)
		printf("NOT FOUND\n");
	return 0;
}


int data[9000];
int main()
{
	int n;
	int i, j;
	scanf("%d",&n);
	scanf("%d%d",&i,&j);
	while((i != 0)||(j != 0))
	{
		data[i] = -1;
		data[j]++;
		scanf("%d%d",&i,&j);
	}
	for (i = 0; i < n; i++)
	{
		if (data[i] == n-1)
		{
			printf("%d\n",i);
			break;
		}
	}
	if (i == n)
		printf("NOT FOUND\n");
	return 0;
}


/*
 * 1.cpp
 *
 *  Created on: 2011-12-19
 *      Author: 1100012870
 */
int whoknow[1000000]={0},knowwho[1000000]={0};
int main()
{
	int i,n,x,y;
	cin>>n;
	cin>>x>>y;
	while(!(x==0 && y==0)){
		whoknow[y]++;
		knowwho[x]++;
		cin>>x>>y;
	}
	for(i=0;i<=n;i++)
		if(knowwho[i]==0 && whoknow[i]==n-1){
			cout<<i<<endl;
			return 0;
		}
	cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
	int n;
	int *a,*index;
	int i,j;
	int result;
	cin >> n;
	a = (int *)malloc(n*n*sizeof(int));
	index = (int *)malloc(n*sizeof(int));
	for (i=0;i<n;i++)
	{
		*(index+i) = i;
	}

	while (1)
	{
		cin >> i >> j;

		if (i==0&&j==0)
		{
			break;
		}
		else
		{
			*(a+n*j+i) = 1;
		}
	}

	for (i=n-1;i>=1;i--)
	{
		if (1 == *(a+n*index[i]+index[i-1]))
		{
			index[i-1] = index[i];
		}
	}

	result = -1;
	for (i=0;i<n;i++)
	{
		if(0 == *(a+n*index[0]+i))
		{
			if (index[0]!=i)
			{
				cout << "NOT FOUND";
				free(a);
				a = NULL;
				free(index);
				index = NULL;
				return 0;
			}
		}
	}

	for (i=0;i<n;i++)
	{
		if(1 == *(a+n*i+index[0]))
		{
			cout << "NOT FOUND";
			free(a);
			a = NULL;
			free(index);
			index = NULL;
			return 0;
		}
	}

	cout << index[0];
	free(a);
	a = NULL;
	free(index);
	index = NULL;
	return 0;
}


int main()
{
    int people[10000] = {0};
    int i, n, a, b, flag = 0;
    cin >> n;
    while(1)
    {
        cin >> a >> b;
        if ( a == 0 && b == 0 )
           break;
        people[a] = -1;
        people[b]++;
    }
    for ( i = 0; i < n; i++ )
        if ( people[i] == ( n - 1 ) )
        {
           cout << i << endl;
           flag = 1;
        }
    if ( flag == 0 )
       cout << "NOT FOUND" << endl;
    return 0;
}


int main()
{
	int n, know[10000] = {0}, beKnown[10000] = {0}, i, j, flag = 0;
	int *p = know, *q = beKnown;
	cin >> n;
	while (1)
	{
		cin >> i >> j;
		if (i == 0 && j == 0)
		{
			break;
		}
		know[i]++;
		beKnown[j]++;
	}
	for (i = 0; i < n; i++)
	{
		if (*p == 0 && *q == n - 1)
		{
			flag = 1;
			break;
		}
		else
		{
			p++;
			q++;
		}
	}
	if (flag == 0)
	{
		cout << "NOT FOUND" << endl;
	}
	else
	{
		cout << i << endl;
	}
	return 0;
}


int main(int argc, char* argv[])
{
	int i,mingren = 0;
	int count;
	int num = 0;
	int temp1,temp2;

	scanf("%d", &num);
	count = num;

	int **relation=(int **)malloc(num*sizeof(int *));
	for(i = 0; i < num; i ++)
	{
		relation[i]=(int *)malloc(num * sizeof(int));
	}
	//?????,?????????
	do
	{
		scanf("%d %d", &temp1, &temp2);
		relation[temp1][temp2] = 1;
	} while (temp2 != 0 || temp1 != 0);
	//////////////////////////////////////////////////////////
	temp1 = 0;
	temp2 = 1;
	for (i = 0; i < num-2; i ++)
	{
		if(relation[temp1][temp2] == 1)
		{
			temp1 = num-1-i;
		}
		else
		{
			temp2 = num-1-i;
		}
	}
	if(relation[temp1][temp2] == 1)
	{
		mingren = temp2;
	}
	else
	{
		mingren = temp1;
	}

	for (i = 0; i < num; i ++)//?????????
	{
		if (i != mingren)
		{
			if(relation[i][mingren] == 0 || relation[mingren][i] == 1)
			{
				mingren = -1;
				break;
			}
		}
	}

	///////////////////////////////////////////////////////////

	if (mingren == -1)
	{
		printf("NOT FOUND\n");
	}
	else
	{
		printf("%d\n", mingren);
	}

	for(i = 0; i < num; i ++)
	{
		free(relation[i]);
	}
	free(relation);

	return 0;
}


int a[300000];
int knowedBy[300000];
int flag[300000];
int main()
{
	int n;
	cin>>n;
	memset(knowedBy, 0, sizeof(knowedBy));
	memset(flag, 0, sizeof(flag));
	int i, j, k;
	while(cin>>j>>k)
	{
		if((j == 0)&&(k == 0))
			break;
		flag[j] = -1;
		knowedBy[k]++;
	}
	int t = 0;
	for(i = 0; i < n; i++)
	{
		if((knowedBy[i] == n-1)&&(flag[i] == 0))
		{
			cout<<i<<endl;
			t = 1;
			break;
		}
	}
	if(t == 0)
		cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
  int n;
  int num[10000];
  cin>>n;
  int i,j;
  for(i = 0; i < n; i++)
    num[i] = n - 1;
  while(1)
  {
    cin>>i>>j;
    if(i == 0 && j == 0)
      break;
    num[i] = -1;
    num[j] --;
  }
  for(i = 0; i < n; i++)
    if(num[i] == 0)
      cout<<i<<endl;
}


int main()
{
	int x,m=0,n=0,i=0,j=0,h=0,k=0,d=0;
	scanf("%d",&x);
	h=x+1;
	int *strm=(int *)malloc(h*sizeof(int));
	int *strn=(int *)malloc(h*sizeof(int));
	for(d=0;d<=x;d++)
	{
		strm[d]=0;
		strn[d]=0;
	}
	for(;;)
	{
		scanf("%d%d",&m,&n);
		if(m==0&&n==0)
		{break;}
		else
		{
			strm[m]=strm[m]+1;
			strn[n]=strn[n]+1;
		}
	}
	for(j=0;j<=x-1;j++)
	{
		if(strm[j]==0&&strn[j]==x-1)
		{
			printf("%d",j);
			k=1;
		}
	}
	if(k==0)
	{printf("NOT FOUND");}
}


// ??????.cpp : Defines the entry point for the console application.
//

int main(int argc, char* argv[]){
	int i,j,n,hang=1,sz[10000][2],renshita,tarenshi,mingliu=0;
	scanf("%d",&n);
	i=0;
	scanf("%d%d",&sz[0][0],&sz[0][1]);
	while(sz[i][0]!=0||sz[i][1]!=0){
		i++;
		scanf("%d%d",&sz[i][0],&sz[i][1]);
		hang++;
	}
	for(j=0;j<n;j++){
		renshita=0;
		tarenshi=0;
		for(i=0;i<hang;i++){
			if(sz[i][1]==j){
				renshita++;
			}
		}
		for(i=0;i<hang-1;i++){
			if(sz[i][0]==j){
				tarenshi++;
			}
		}
		if(renshita==n-1&&tarenshi==0){
			printf("%d\n",j);
			mingliu++;
		}
	}
	if(mingliu==0){
		printf("NOT FOUND");
	}
	return 0;
}


int main()
{
int n,i;
int a,b;
int * temp, * temp2;
scanf("%d",&n);
int *p = (int *)malloc(n*sizeof(int));
int *q = (int *)malloc(n*sizeof(int));
temp = p;
temp2 = q;
for (i=0;i<n;i++)
    {*(p+i) = 0; *(q+i) = 0;}
while(1==1)
    {
        p = temp;
        q = temp2;
        scanf("%d %d",&a,&b);
        if (a != 0 || b != 0)
           {
                 (*(p+a))++;
                 (*(q+b))++;
                 }
        else
             break;
        }
for (i=0;i<n;i++)
{
    if (*(p+i)==0 && *(q+i)==n-1)
       {printf("%d",i);break;}
    }
if (i==n) printf("NOT FOUND\n");
    }


int flag[10000];
int num[10000];
int main()
{
	int n;
	cin>>n;
	int a = 1, b = 1;
	memset(flag, 0, sizeof(flag));
	memset(num, 0, sizeof(num));
	cin>>a>>b;
	while((a != 0)||(b != 0))
	{
		flag[a] = 1;
		num[b]++;
		cin>>a>>b;
	}
	int i;
	int j = 0;
	for(i = 0; i < n; i++)
	{
		if(flag[i] == 0 && num[i] == n - 1)
		{
			cout<<i<<endl;
			j = 1;
		}
	}
	if(j == 0)
		cout<<"NOT FOUND"<<endl;
	return 0;
}


int sum[M][2];

int main()
{
    int n, i,j;
    scanf("%d", &n);
    while (scanf("%d%d", &i, &j)!=EOF) {
	sum[i][0] ++;
	sum[j][1] ++;
    }
    for (i=0; i<n; i++) {
	if (sum[i][1] - sum[i][0] == n-1) {
	    printf("%d\n", i);
	    return 0;
	}
    }
    /* not found */
    printf("NOT FOUND\n");
    return 0;
}


int main(){
	int n;
	int a[10010],b[10010];
	int p,q;
	cin>>n;
	cin>>p>>q;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	while(p!=0 || q!=0){
		a[p]++;
		b[q]++;
		cin>>p>>q;
	}
	int i;
	for(i=0;i<n;i++){
		if(a[i])
			continue;
		else{
			if(b[i] == n-1){
				cout<<i<<endl;
			}break;
		}
	}return 0;
}


int main ()
{
int n, i = 0,j, flag = 0, tempa,tempb;
int a[100000] = {0}, b[100000] = {0};

cin >> n;
while(cin >> tempa >> tempb)
{
if(tempa == 0 && tempb == 0)
break;
b[tempb] ++;
a[tempa] ++;
}
for(i = 0;i < n;i ++)
{
if( b[i] == n - 1 && a[i] == 0)
cout << i << endl;
flag = 1;
}
if(flag == 0)
cout << "NOT FOUND" << endl;
return 0;
}


struct person
{
	int kn;
	int bkn;
};
main()
{
	int n,a,b,i;
	struct person *p;
	scanf("%d",&n);
	p=(struct person *)malloc(n*sizeof(struct person));
	for (i=0;i<n;i++)
	{
		p[i].kn=0;
		p[i].bkn=0;
	}
	while (1)
	{
		scanf("%d %d",&a,&b);
		if (a==0 && b==0)
			break;
		p[a].kn++;
		p[b].bkn++;
	}
	for (i=0;i<n;i++)
	{
	    if (p[i].kn==0 && p[i].bkn==n-1)
			printf("%d\n",i);
	}
	free(p);
}


struct ming
{
       int n;
       int m;
       struct ming *next;
};

struct ming*creat()
{
       struct ming *head,*p1,*p2;
       int i=0;
       p1=p2=(struct ming*)malloc(LEN);
       scanf("%d%d",&p1->n,&p1->m);
       head=NULL;
       while(p1->n!=0||p1->m!=0)
       {
                                i++;
                                if(i==1){head=p1;}
                                else
                                p2->next=p1;
                                p2=p1;
                                p1=(struct ming*)malloc(LEN);
                                scanf("%d%d",&p1->n,&p1->m);
                                //printf("%d %d\n",p1->n,p1->m);
       }
       p2->next=NULL;
       return(head);
}
int found(int l,struct ming*head)
{
    int i=0;
    struct ming *p1;
    p1=head;
    while(p1!=NULL)
    {
                         if(p1->m==l)
                         {i++;
                         //printf("%d\n",p1->n);
                         }
                         p1=p1->next;
                         //printf("%d %d\n",p1->n,p1->m);
    }
    return(i);
}

int main()
{
    int a[100][100];
    int n,o,k,p;
    scanf("%d",&n);
    struct ming *head;
    head=creat();
    for(o=0,k=0;o<n;o++)
    {
                    p=found(o,head);
                    //printf("%d\n",p);
                    if(p==n-1)
                    {
                            printf("%d\n",o);
                            k++;}
    }
    if(k==0)printf("NOT FOUND");
    getchar();
    getchar();
    getchar();
}


int main()
{
	int a[100000] = { 0 };
	int x , y;
	int num[10000] = { 0 };
	int n, k;
	cin >> n;
	int i = 0;
	int j;
	int count = 0;
	cin >> x >> y;
	do
	{
		a[i] = x;
		num[y] ++;
		i ++;
		cin >> x >> y;
	}while( !(x == 0 && y == 0 ) );
	j = i;
	for( i = 0; i < n; i ++)
	{
		if( num[i] == n - 1 )
		{
			for( k = 0 ; k < j; k ++)
			{
				if( a[k] == i)
					break;
				if( k == j - 1)
				{
					cout << i << endl;
					count++;
				}
			}
		}
	}
	if( count == 0 )
		cout << "NOT FOUND" << endl;
	return 0;
}


int a[maxn];
int main()
{
	int n,i,x1,x2;
	memset(a,0,sizeof(a));
	scanf("%d",&n);
	for (i=0;;i++) {
		scanf("%d %d",&x1,&x2);
		if (x1+x2==0)
			break;
		if (a[x2]!=-1)
			a[x2]++;
		a[x1] = -1;
	}
	for (i=0;i<n;i++)
		if (a[i] == n-1) {
			cout<<i<<endl;
			return 0;
		}
	cout<<"NOT FOUND"<<endl;

}


struct note
{
	int know;
	int known;
}men[10010];

int main()
{
	int n, i, j, flag = 0;
	cin >> n;
	while(cin >> i >> j)
	{
		if (i == 0 && j == 0)
			break;
		men[i].know++;
		men[j].known++;
	    if (men[j].known == n - 1 && men[j].know != n)
		{
			cout << j;
			flag = 1;
		}
		if (men[i].known == n - 1 && men[i].know != n)
		{
			cout << i;
			flag = 1;
		}
	}
	if (flag == 0)
		cout << "NOT FOUND";
	return 0;
}


int main()
{
	int n;
	cin >> n;
	int take[10000];
	int check[10000];
	for (int p = 0; p < n; p++)
	{
		take[p] = 0;
		check[p] = 0;
	}
	int i, j;
	while(1)
	{
		cin >> i >> j;
		if (i == 0 && j == 0)
			break;
		else
		{
			take[i] = 1;
			check[j]++;
		}
	}
	int flag = 0;
	for (int k = 0; k < n; k++)
	{
		if (take[k] == 0 && check[k] == n - 1)
		{
			cout << k << endl;
			flag = 1;
		}
	}
	if (flag == 0)
		cout << "NOT FOUND" << endl;
	return 0;
}


int a[10010][10010];
int main()
{
	int n,i,j,flag=0;
	cin>>n;
	cin>>i>>j;
	while(i>0||j>0){
		a[i][j]=1;
		cin>>i>>j;
	}
	for(int i=0;i<n;i++){
		double s=0,t=0;
		for(int j=0;j<n;j++){
			s+=a[i][j];
			t+=a[j][i];
		}
		if(s==0&&t==n-1){
			cout<<i<<endl;
			flag=1;
			break;
		}
	}
	if(!flag)
		cout<<"NO FOUND"<<endl;
	return 0;
}


int main()
{
	int n, a, b, max, maxone;
	int person[99999] = {0};
	cin >> n;
	max = 0;
	maxone = -1;
	while (cin >> a >> b)
	{
		if (a == 0 && b == 0)
			break;
		person[b] ++;
		if (person[b] > max)
		{
			max = person[b];
			maxone = b;
		}
	}
	if (max == n - 1)
		cout << maxone << endl;
	else
		cout << "NOT FOUND" << endl;
	return 0;
}


main()
{
      int n;
      scanf("%d",&n);
      int *a=(int *)malloc(n*sizeof(int));

      int k,i,j;
      for(k=0;k<n;k++)
      {a[k]=0;}
      for(k=0;;k++)
      {
                   scanf("%d %d",&i,&j);
                   if(i==0&&j==0) break;
                   else
                   {
                       a[i]-=1;
                       a[j]+=1;

                   }
      }
      for(k=0;k<n;k++)
      {
                      if(a[k]==(n-1))
                      {
                                     printf("%d",k);
                                     break;
                                     k=0;
                      }
      }
      if(k==n) printf("NOT FOUND");
      getchar();
      getchar();
}


int main()
{
    int n,i;
    cin>>n;
    int famous[n+1];
    for(i=0;i<n;i++)
   famous[i]=0;
    int a,b;
    while(1)
    {
        cin>>a>>b;
        if(a==0&&b==0)
        break;

        famous[b]++;

    }
    int m=0;
    for(i=1;i<n;i++)
    {
         if(famous[i]==n-1)
         {
         cout<<i;
         m++;
         }
    }
    if(m==0)
    cout<<0<<endl;
    return 0;

}


int main()
{
    int n,i,x,y;
    int a[100000];

    cin>>n;
    for(i=0;i<n;i++) a[i]=1;
    int judge1,judge2;
    cin>>judge1>>judge2;
    if(judge1==0&&judge2==0) {cout<<"NOT FOUND"; return 0;}
    while(judge1!=0||judge2!=0)
    {
        if(judge1==judge2)
        {
            cin>>judge1>>judge2;
            continue;
        }
        else
        {
            a[judge1]=0;
            cin>>judge1>>judge2;
        }
    }
    int num=0,sum=0;

    for(i=0;i<n;i++)
    {
        if(a[i]==1)
        {
            sum++;
            num=i;
        }
    }
    if(sum==0||sum>1) cout<<"NOT FOUND";
    else cout<<num;
    return 0;
}


int main()
{
    int Ren1,Ren2;
    int i,j,n;
    int value[MAX]={0};
    cin>>n;
    while(1)
    {
        cin>>Ren1>>Ren2;
            if(!(Ren1==0 && Ren2==0))
            {
              value[Ren1]--;
              value[Ren2]++;
            }
           else
           break;
    }

   for(i=0;i<=n-1;i++)
     if(value[i]==n-1)
      { cout<<i;  goto line;}
     cout<<"NOT FOUND";
line:

 return 0;
}


int a[10000];
int main()
{
	int tell, n, i, j, k, *p;
	p = a;
    cin >> n;
	for(i = 0; i < n; i++)
		a[i] = 1;
	while(cin >> i >> j)
		if(i != j)
			*(p + i) = 0;
	for(i = 0; i < n; i++)
		if(a[i])
		{
			cout << i << endl;
			break;
		}
	if(i == n)
		cout << "NOT FOUND" << endl;
	return 0;
}


int k[10000][10000];
int n,a,b,c,i,j,ans;

int main()
{
	scanf("%d",&n);
	while (1)
	{
		scanf("%d%d",&a,&b);
		if (a == 0 && b == 0) break;
		else
			k[a][b] = 1;
	}
	c = 0;
	for (i = 1;i < n;i ++)
		if (k[c][i] == 1) c = i;
	for (i = 0;i < n;i ++)
      if (i != c )
		  if (k[i][c] == 1 && k[c][i] == 0) continue;
		  else break;
    if (i == n) printf("%d\n",c);else printf("NOT FOUND\n");
}


int main()
{
	int n, m;
	int p, q = 0, r = 0;
	int i = 0, j;
	int a, b, c[10000] = {0}, d[10000] = {0};
	cin >> n;
	while(1)
	{
		cin >> a >> b;
		if(a == 0 && b == 0)
			break;
		c[b]++;
		d[a]++;
		i++;
	}
	for(i = 0; i < n; i++)
	{
		if(c[i] == n - 1)
		{
			if(d[i] == 0)
			{
				cout << i << endl;
				break;
			}
			else
				cout << "NOT FOUND" << endl;
		}
		else
			q++;
	}
	if(q == n)
		cout << "NOT FOUND" << endl;
	return 0;
}


int main()
{
	int i, n, x, y;
	int know[10000], beknown[10000];
	for (i = 0; i < 10000; i ++)
	{know[i] = 0; beknown[i] = 0;}
	cin >> n;
	int *p = know;
	int *q = beknown;
	while (1)
	{
		cin >> x >> y;
		if (x == 0 && y == 0)
			break;
		(*(p + x))++;
		(*(q + y))++;
	}
	int flag = 1;
	for (i = 0; i < n; i ++)
		if (know[i] == 0 && beknown[i] == n - 1)
		{
			flag = 0;
			cout << i << endl;
			break;
		}
	if (flag)
		cout << "NOT FOUND" << endl;
	return 0;
}


int main()
{
    int n,i;
    int a[100000],b[100000];
    scanf("%d",&n);
    for(i=0;;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if(a[i]==0&&b[i]==0)
        {
            break;
        }
    }
    int count=0,count0=0;
    for(int l=0;l<n;l++)
    {
        count=count+l;
    }
    for(int j=0;j<n;j++)
    {
        int count1=0,count2=0;
        for(int k=0;k<i;k++)
        {
            if(a[k]==j)
            {
                count1++;
            }
            if(b[k]==j)
            {
                count2=count2+a[k];
            }
        }
        if(count1==0&&count2==count-j)
        {
            printf("%d\n",j);
            count0++;
        }
    }
    if(count0==0)
    {
        printf("NOT FOUND");
    }
    return 0;
}


int main()
{
	int n,i,r1,r2,refer=0;
	scanf("%d",&n);
	int *sz=(int*)malloc(sizeof(int)*n);
	int *sz2=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	{
		sz[i]=1;
		sz2[i]=0;
	}
	while(1)
	{
		scanf("%d %d",&r1,&r2);
		if(r1==0 && r2==0)
		{
			break;
		}
		if(r1!=r2)
		{
			sz[r2]++;
			sz2[r1]=1;
		}
	}
	for(i=0;i<n;i++)
	{
		if(sz[i]==n && sz2[i]==0)
		{
			printf("%d",i);
			refer=1;
		}
	}
	if(refer==0)
	{
		printf("NOT FOUND");
	}
	free(sz);
	free(sz2);
	return 0;
}


int main()
{
         int n;
         int x,y,t;
         cin>>n;
         int ans=0;
         int count[n];
         for(int i=0;i<n;i++)count[i]=0;
         while(cin>>x>>y)
         {
                  if(x==0 && y==0){break;}
                  else
                  {
                           count[y]++;
                  }
         }
         for(int i=0;i<n;i++)
         {
                                    if(count[i]==n-1){ans++;t=i;}
         }
         if(ans==1)cout<<t;
         else cout<<"NOT FOUND";
}


int a[MAX][MAX]={0};

int main()
{
    int n, i, j, k;
    scanf("%d", &n);
    while(scanf("%d%d", &i,&j)!=EOF &&(i||j))
                        a[i][j]=1;

    i=0, j=n-1;
    while(i<j)
    {
              if(a[i][j])
                         i++;
              else j--;
    }
    int flag=0;
    for(k=0; k<n; k++)
    {
             if(a[i][k])
                        flag=1;
             if(!a[k][i]&&k!=i)
                        flag=1;
    }
    if(flag)
            printf("NOT FOUND\n");
    else    printf("%d\n", i);
    return 0;
}


struct person
{
	int knownum;
	int welknownnum;
}p[100000];

int main()
{
	int n=0;
	cin>>n;
	int i=0;
	for( i=0; i<n; i++ )
	{
		p[i].knownum=0;
		p[i].welknownnum=0;
	}
	int j=0;
	while(cin>>i>>j)
	{
		if( i==0 && j==0 )
		{
			break;
		}
		else
		{
			p[i].knownum++;
			p[j].welknownnum++;
		}
	}
	for( i=0; i<n; i++ )
	{
		if( p[i].knownum == 0 && p[i].welknownnum == n-1 )
		{
			cout<<i<<endl;
			break;
		}
	}
	if( i==n )
	{
		cout<<"NOT FOUND"<<endl;
	}
}


int know[100000]={0};
int be_known[100000]={0};
int main()
{
	int n;
	scanf("%d",&n);
	while(1)
	{
		int temp1=0,temp2=0;
		scanf("%d%d",&temp1,&temp2);
		if((temp1==0)&&(temp2==0)) break;
		else
		{
			know[temp1]++;
			be_known[temp2]++;
		}
	}
	int flag =-1;
	for(int i=0;i<n;i++)
	{
		if((know[i]!=n-1)&&(be_known[i]==n-1))
		{
			flag=i;
			break;
		}
	}
	if(flag!= -1)
	{
		printf("%d",flag);
	}
	else
	{
		printf("NOT FOUND");
	}
	return 0;
}


int main ()
{
	int n, i, counta, countb, person1[50000], person2[50000];
	int flag = 0;
	int *Person1, *Person2;
	cin >> n;
	for ( Person1 = person1, Person2 = person2; ; Person1 ++, Person2 ++ )
	{
		cin >> *Person1 >> *Person2;
		if ( *Person1 == 0 && *Person2 == 0 )
			break;
	}
	for ( i = 0; i < n; i ++ )
	{
		counta = 0;
		countb = 0;
		for ( Person1 = person1, Person2 = person2; ; Person1 ++, Person2 ++ )
		{
			if ( *Person1 == 0 && *Person2 == 0 )
				break;
			if ( *Person1 == i )
				counta ++;
			if ( *Person2 == i )
				countb ++;
		}
		if ( counta == 0 && countb == n - 1 )
			cout << i << endl;
	}
	return 0;
}


int main()
{
	int num[1000000]={0};
	int n, i, j, *p, count = 0, flag = 0;
	cin >> n;
	do
	{
		cin >> i;
		cin >> j;
		if(i + j == 0)     break;
		else
		{
			num[j]++;
		}
	}while(1);
	p = num;
	while(count < n)
	{
		if( *p == n-1 )
		{
			cout << count;
			flag = 1;
			break;
		}
		else
		{
			p++;
			count++;
		}
	}
	if(!flag)       cout << "NOT FOUND";

	return 0;
	}


int main(){
	int n;
	cin>>n;
	int ai[n],aj[n];
	int c,d;
	for(int i=0;i<n;i++){
		ai[i]=aj[i]=0;
	}
	while(true){
		cin>>c;
		cin>>d;
		if(c==0&&d==0)break;
		else{
			ai[c]++;
		    aj[d]++;
		}
	}
	int j;
	for( j=0;j<n;j++){
		if(ai[j]==0&&aj[j]==n-1){
			cout<<j<<endl;
			break;}
	}
	if(j==n)cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
	int n;
	cin >> n;
	int l[10000],r[10000];
	memset(l,0,sizeof(l));
	memset(r,0,sizeof(r));
	while(1)
	{
		int a,b;
		cin >> a>>b;
		if(a==0 && b==0)
			break;
		l[a] = 1;
		r[b] +=1;
	}
	for(int i=0;i<n;i++)
	{
		if(l[i] == 0 && r[i] == n-1)
		{
			cout << i <<endl;
			return 0;
		}
	}
	cout <<"NOT FOUND"<<endl;
	return 0;

}


int a[1000000];
int main()
{
	int n;
	int x,y;
	cin>>n;
	while(1)
	{
		cin>>x>>y;
		if(x==0 && y==0)break;
		a[x]=-1;
		if(a[y]>=0)a[y]++;
	}
	int flag=false;
	for(int i=0;i<n;i++)if(a[i]==n-1){cout<<i<<endl;flag=true;break;}
	if(flag==false)cout<<"NOT FOUND"<<endl;
	return 0;
}


int main()
{
	struct mingliu
	{
		int i ;
		int j ;
	}people[10000];
	int n , k , a[10000] , p = 0;
	memset(a,0,sizeof(a));
	cin >> n;
	for(k = 0 ;;k++)
	{
		cin >> people[k].i >>people[k].j;
		if(people[k].i == 0 && people[k].j ==0)
			break;
		a[people[k].i]++;
	}
	for(k = 0 ; k < n ; k++)
	{
		if(a[k] == 0)
		{
			cout << k <<endl;
			p++;
		}
		if(k == n - 1 && p == 0)
		{
			cout << "NOT FOUND"<<endl;
		}
	}
	return 0;
}


int main()
{
	int n, x, y, j, flag;
	int beknown[10000];
	while(cin>>n)
	{
		memset(beknown, 0, sizeof(beknown));
		while(1)
		{
			cin>>x>>y;
			if(x==0 && y==0)
				break;
			beknown[x] = -1;                         //?????????
			if(beknown[y]!=-1)
				beknown[y]++;
		}
		flag = false;
		for(j=0; j<n; j++)
			if(beknown[j]==n-1)                       //????????????
			{
				flag = true;
				cout<<j<<endl;
			}
		if(!flag)
			cout<<"NOT FOUND"<<endl;
	}
	return 0;
}


/*
 * xiaoceyan5.4.cpp
 * ?????????
 *  Created on: 2011-1-8
 *      Author: william
 */
int main()
{
	int n, i, j, k, num, mingliu=-1;
	int b[100000][2];
	cin>>n;
	for(i=0 ;; i++)
	{
		cin>>b[i][0]>>b[i][1];
		if(b[i][0]==0&&b[i][1]==0) break;
	}
	num=i;
	for(i=0; i<n; i++)
	{
		int q=0;
		for(j=0; j<num; j++)
		{
			if(b[j][0]==i) break;
		}
		if(j==num)
		{
			for(k=0; k<num; k++)
			{
				if(b[k][1]==i) q++;
			}
			if(q==n-1) mingliu=i;
		}
	}
	if(mingliu==-1) cout<<"NOT FOUND";
	else cout<<mingliu;
	return 0;
}


int way(int m,int n)
{
    if(m==0||n==1)
        return 1;
    else if(n>m)
        return way(m,m);
    else
        return way(m,n-1)+way(m-n,n);
}
int main()
{
    int i,t,m,n;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%d%d",&m,&n);
        printf("%d\n",way(m,n));
    }

return 0;
}


int f(int m,int n){
	if(m<0) return 0;
	if(n==1) return 1;
	return f(m,n-1)+f(m-n,n);
}

void main(){
    int m,n,t;
	scanf("%d",&t);
	while(t-->0){
		scanf("%d%d",&m,&n);
		printf("%d\n",f(m,n));
	}
}


int apple( int m , int n ) ;

int main()
{
	int t , i , k , m , n ;

	cin >> t ;

	for( i = 1 ; i <= t ; i ++ )
	{
		cin >> m >> n ;

		k = apple( m , n ) ;

		cout << k << endl ;
	}

	return 0 ;
}

int apple( int m , int n )
{
	if( m == 1 || n == 1 || m == 0 )
		return 1 ;

	if( m >= n )
		return( apple( m , n - 1 ) + apple( m - n , n ) ) ;

	else
		if( m < n )
			return apple( m , n - 1 ) ;

}


int function(int n,int m)
	{
		int f;
		if(n==1||m==0||n==0||m==1)
			f=1;
		else if(m<0)
			f=0;
		else
			f=function(n-1,m)+function(n,m-n);
		return(f);
	}
int main()
{
	int t,m,n,k;
	scanf("%d",&t);
	int i;
	for(i=0;i<t;i++)
	{
     scanf("%d %d",&m,&n);
	if(m<n)
		{
			n=m;
			k=function(n,m);
	     }
	else
		{
			k=function(n,m);
	     }

	printf("%d\n",k);
	}
}


// ?????.cpp : Defines the entry point for the console application.
//

int fen(int x,int y);
int main(int argc, char* argv[])
{
	int i,m,n,sum;
	scanf("%d",&sum);
	for(i=0;i<sum;i++){
		scanf("%d%d",&m,&n);
		printf("%d\n",fen(m,n));
	}
	return 0;
}

int fen(int x,int y){
	int result=0;
	if(y!=1)result+=fen(x,y-1);
	if(x-y>=0&&y!=1)result+=fen(x-y,y);
	if(y==1){
		result++;
		return result;
	}
	return result;
}


int apple(int m,int n)
{
	int k;
	if(n==1)
		k=1;
	else if(m==1)
		k=1;
	else if(m==2)
		k=2;
	else if(m<n)
		k=apple(m,n-1);
	else
	k=apple(m,n-1)+apple(m-n,n);
	return k;
}
int main()
{
	int t,m,n,k;
	scanf("%d",&t);
	int i;
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&m,&n);
		k=apple(m,n);
	    printf("%d\n",k);
	}

	return 0;
}


int digui(int m,int n)
{
	int p;
	if(m<n)
		p=digui(m,m);
	else
	{
		if(m==0||n==1)
		p=1;
		else p=(digui(m,n-1)+digui(m-n,n));
	}return(p);
}
void main()
{
	int m,n,t,i,a[20],b[20],c[20],p,q;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&b[i],&c[i]);
		p=b[i];q=c[i];
		a[i]=digui(p,q);
	}
	printf("%d",a[0]);
	if(t>=1)
	for(i=1;i<t;i++)
	printf("\n%d",a[i]);
}


int gedui(int zong, int duishu,int ini){
	int p,k=0,end;
	end=zong/duishu;
	if(duishu>2){
		for(p=ini;p<=end;p++){
			k+=gedui(zong-p,duishu-1,p);
		}
	}
	else if(duishu==2){
		k=zong/2-ini+1;
	//	printf("2zong%d,ini%d,k%d\n",zong,ini);
	}
	else if(duishu==1){
		k=1;
	}
	return k;
}

int r(int zong,int dui){
	int o,count=0;
	for(o=1;o<=dui;o++){
		count+=gedui(zong,o,1);
	//	printf("count%d,zong%d,dui%d\n",count,zong,dui);
	}
	return count;
}

int main(){
	int k,m,n;
	int i,dui,u;
	scanf("%d",&k);
	for(i=0;i<k;i++){
		u=0;
		scanf("%d%d",&m,&n);
		if(m>n){
			dui=n;
		}
		else{
			dui=m;
		}
		u=r(m,dui);
		if(i!=0){
			printf("\n");
		}
		printf("%d",u);
	}
	return 0;
}


int fun(int m,int n,int j);
int main()
{
     int s,i,x;
     int m[100],n[100];
     scanf("%d",&x);
     for(i=0;i<x;i++)
    {
     scanf("%d%d",&m[i],&n[i]);
    }
     for(i=0;i<x;i++)
     {
     if(n[i]>m[i])
     n[i]=m[i];
     s=fun(m[i],n[i],0);
     printf("%d\n",s);
     }
}
int fun(int m,int n,int j)
{
    int i,s=0;
    if(n==1) return m>=j;
    for(i=j;i<m;i++) s+=fun(m-i,n-1,i);
return s;
}


void main()
{
	int f(int,int);
	int m,n,t;
	scanf("%d",&t);
	while(t>0)
	{
		scanf("%d %d",&m,&n);
		printf("%d\n",f(m,n));
		t--;
	}
}
int f(int x,int y)
{
	if(x==0||y==1)
		return 1;
	if(x<y)
		return f(x,x);
	return f(x-y,y)+f(x,y-1);
}


int N,n,m;
int max(int x,int y)
{
    int c;
    if(y<=0)
    {
        if(y==0)
        c=1;
        else
        c=0;
    }
    else
    {
        if(x==1)
            c=1;
        else
            c=max(x-1,y)+max(x,y-x);
    }
    return(c);
}
main()
{
      int i;
      scanf("%d",&N);
      for(i=1;i<=N;i++)
      {
          scanf("%d%d",&n,&m);
          printf("%d\n",max(m,n));
      }
     }


int count(int m,int n)
{
    int c;
    if (m<0)
    c=0;
    else if (n==1)
    c=1;
    else
    c=count(m,n-1)+count(m-n,n);
    return c;
}
int main(int argc, char *argv[])
{
  int t,i,m,n;
  scanf("%d",&t);
  for (i=0;i<=t-1;i++)
  {
      scanf("%d%d",&m,&n);
      printf("%d\n",count(m,n));
  }
  return 0;
}


main()
{
      int m[100],n[100],a[100],t;
      int ppp(int m,int n);
      int fff(int m,int n);
      for(int i=0;i<100;i++)
      {
              a[i]=0;
      }
      scanf("%d",&t);
      for(int i=0;i<t;i++)
      {
              scanf("%d %d",&m[i],&n[i]);
              a[i]=ppp(m[i],n[i]);
      }
      for(int i=0;i<t;i++)
      {
              printf("%d\n",a[i]);
      }
}
int ppp(int m,int n)
{
    int p;
    int fff(int m,int n);
    if(n>1)
    p=ppp(m,n-1)+fff(m,n);
    else if(n==1)
    p=1;
    return(p);
}
int fff(int m,int n)
{
    int f;
    if(m>n)
    f=ppp(m-n,n);
    else if(m==n)
    f=1;
    else if(m<n)
    f=0;
    return(f);
}


int devide(int x,int y)
{
    if(y==1)
	{
		return 1;
	}

	else if(x==1)
	{
		return 1;
	}
	else if(x<y)
	{
		return devide(x,x);
	}
	else if(x>y)
	{
		return devide(x,y-1)+devide(x-y,y);
	}
	else if(x==y)
	{
		return devide(x,y-1)+1;
	}
}
int main()
{
    int n,i;
    scanf("%d",&n);
    int x,y;
    int out;
    for(i=0;i<=n-1;i++)
    {
        scanf("%d %d",&x,&y);
        out=devide(x,y);
        printf("%d\n",out);
    }
}


int main()
{
	int t;//???????
	cin>>t;
	int f(int,int);
	for(int i=1;i<=t;i++)
	{
		int m,n;
		cin>>m>>n;//m????n???
		int ans;
		ans=f(n,m);
		cout<<ans<<endl;
	}
	return 0;
}
int f(int pa,int pi)
{
	int c=0;

	if(pa==1||pi==0)
	{
		c=1;
	}
	if(pi<0)
	{
		c=0;
	}
	if(pa>1&&pi>=1)
		c=f(pa-1,pi)+f(pa,pi-pa);
	return(c);
}


int fang(int m,int n);//??????
int main()
{
int p,i,m,n;
cin>>p;
for(i=1;i<=p;i++)
{
cin>>m>>n;
cout<<fang(m,n)<<endl;//????
}
return 0;
}
int fang(int m,int n)
{
int sum;
if(n==1||m==1||m==0)//????
sum=1;
else if(m<0)
sum=0;
else sum=fang(m,n-1)+fang(m-n,n);//???
return sum;
}


int sum = 0;
int work( int a,int b )
{
     if((a==0)||(a==1)||(b==1)||(b==0))
     return 1;
     if( b>a )
     b = a;
     return( work(a,b-1)+work(a-b,b));

}
int main()
{
   int m , n , t , i;
   scanf( "%d",&t );
   for( i = 1 ;i <= t;i++  )
   {scanf("%d%d",&m,&n);
    if( n>=m )
     n=m;
    sum = work( m ,n);
    printf("%d\n",sum);
    sum = 0;
   }
}


int Apple(int m, int n)
{
	if (m == 0 || n == 0)
		return 0;
	if (m == 1 || n == 1)
		return 1;
	if (m < n)
		return Apple(m, m);
	if (m == n)
		return Apple(m, n - 1) + 1;
	return Apple(m - n, n) + Apple(m, n - 1);
}
int main()
{
	int t, a, b;
	cin >> t;
	while (t)
	{
		cin >> a >> b;
		cout << Apple(a, b) << endl;
		t--;
	}
	return 0;
}


int put( int , int );

int main()
{
	int t , i;
	int m , n;
	int k;

	cin >> t;

	for ( i = 1; i <= t; i++ )
	{
		cin >> m >> n;
		k = put(m , n);
		cout << k << endl;
	}

	return 0;
}

int put( int x, int y)
{
	if ( x == 0 || y == 1 )
		 return 1;
	else
	{
		if ( x >= y )
			return put (x , y-1) + put( x-y, y );
		if ( x < y )
			return put(x , y-1);
	}
}


int allfilled(int m,int n);
int notallfilled(int m,int n);
main()
{
      int t,i,m,n,c,d,sum;
      scanf("%d\n",&t);
      for(i=0;i<t;i++)
      {
      scanf("%d %d",&m,&n);
      if(m>=n)
      {
          c=notallfilled(m,n);
          d=allfilled(m,n);
          sum=c+d;
      }
      else
          sum=notallfilled(m,n);
      printf("%d\n",sum);
      }

}

int allfilled(int m,int n)
{
     int z;
     if(m==n)
        return 1;
     else if(n==1)
        return 1;
     else
     {
     if(m-n>=n)
        z=allfilled(m-n,n)+notallfilled(m-n,n);
     else
        z=notallfilled(m-n,n);
     return z;
     }
}

int notallfilled(int m,int n)
{
     int z;
     if(n==1)
        return 0;
     else
     {
     if(m<n-1)
        z=notallfilled(m,n-1);
     else
        z=allfilled(m,n-1)+notallfilled(m,n-1);
     return z;
     }
}


int i,j,k,m,n,way,way1;
int put(int m,int n)
{
	if(m >= 0)
	{
    	if (n == 1)
	    	way = 1;
    	else
	    	way = put(m - n,n) + put(m,n-1) ;
	}
	else
		way = 0;
	return way;
}
int main()
{
	int t;
	cin>>t;
	while (t--)
	{
		cin>>m>>n;
		way = put(m,n);
		cout<<way<<endl;
	}
	return 0;
}


int ways(int a,int b)
{
	int p;
	if(b==1||a==0||a==1)
		return 1;
	else
	{
		if(a<b)
			p=ways(a,a);
		else
		p=ways(a,b-1)+ways(a-b,b);
	}
	return p;
}

void main()
{
	int n[20],m[20],t,i,k[20];
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&n[i],&m[i]);
		k[i]=ways(n[i],m[i]);
	}
	for(i=0;i<t;i++)
		printf("%d\n",k[i]);
}


int num(int m,int n,int sum)
{
	if (m==1 || n==1)
	{
		sum++;
		return sum;
	}
	if (m<n)
		sum=num(m,n-1,sum);
	else if (m==n)
		sum=1+num(m,n-1,sum);
	if (m>n)
	{
		sum=num(m,n-1,sum);
		sum=num(m-n,n,sum);
	}
	return sum;
}

void main()
{
	int i,t,m,n,sum=0;
	scanf ("%d",&t);
	for (i=0;i<t;i++)
	{
		sum=0;
		scanf ("%d %d",&m,&n);
		sum=num(m,n,sum);
		printf ("%d\n",sum);
	}
}


int an( int,int );
int main()
{
	int m,n;
	int t,i,j;
	cin >> t;

	if( t>0)
	{
		for( i=0;i<t;i++ )
		{
              cin >> m >> n;
			  cout << an( m,n ) << endl;
		}
	}
	return 0;
}

int an ( int m,int n)
{
	if( ( m==0 )||(n==1) )
		return 1;

	if( m>=n )
		return an(m-n,n)+an(m,n-1);
	else
		return an( m,n-1);
}


int f[30][30];
int K(int m, int n)
{
	if(f[m][n])
	{
		return f[m][n];
	}
	else if (m==1||n==1)
	{
		f[m][n]=1;
		return f[m][n];
	}
	else if(m<n)
	{
		f[m][n]=K(m,m);
		return f[m][n];
	}
	else if (m==n)
	{
		f[m][n]=K(m,m-1)+1;
		return f[m][n];
	}
	else
	{
		f[m][n]=K(m-n,n)+K(m,n-1);
		return f[m][n];
	}
}

int main(){
int t;
scanf("%d", &t);
int M, N, k;
for (int i=0; i<t; i++)
	{
		scanf("%d%d", &M, &N);
		k=K(M,N);
		printf("%d\n", k);
	}
return 0;
}


int f(int m,int n)
{
    int c;
    if (m==1||n==1||m==0)
    {
                   c=1;
    }
    else
    {
    if (m<n)
    {
              c=f(m,m);
    }
    else
    {
              c=f(m,n-1)+f(m-n,n);
    }
    }
    return (c);
}
main()
{
      int t,m,n;
      scanf("%d",&t);
      int i=0;
      for (i=0;i<=t-1;i++)
      {
          scanf("%d %d",&m,&n);
          printf("%d\n",f(m,n));
      }
      getchar();getchar();getchar();getchar();getchar();getchar();
}


int f(int m,int n){
	int result=0;
	if(m==0||n==1)
		return 1;
	if(m<0)
		return 0;

	if(m>=n)
		result+=f(m,n-1)+f(m-n,n);
	else
		result+=f(m,n-1);

	return result;
}

    int main(){
	int m,n,i,t,a;
	scanf("%d",&t);

	for(i=0;i<t;i++){
		scanf("%d%d",&m,&n);

		a=f(m,n);

		if(i<t-1){

			printf("%d\n",a);
		}
		else
			printf("%d",a);

	}
	return 0;
	}


int way(int m, int n)
{
	if(n == 1)
		return 1;

	 if(m > n)
	 {
		return way(m, n - 1) + way(m - n , n);
	 }
	 if(m < n)
	 {
		return way(m, n - 1);
	 }
	 if(m == n)
		 return way(m, n - 1) + 1;
}

int main()
{
	int i, l, a, m, n;
	cin >> l;
	for(i = 1 ; i <= l ; i++)
	{
		cin >> m >> n;
		a = way(m, n);
		cout << a << endl;
	}

	return 0;
}