semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
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);
}
int main()
{
	int n, i, j, flag1;
	int a, b;
	int flag[10000] = {0};
    int num[10000] = {0};
	cin >> n;
	flag1 = 0;
	j = 0;
	while(1)
	{
		cin >> a>> b;
		if ((a == 0) && (b == 0))
			break;
		else
		{
			flag[a] = 1;
			num[b]++;
		}
		j++;
	}
	for (i = 0; i < n; i++)
	{
		if ((flag[i] == 0) && (num[i] == n - 1))
		{
			cout <<	i << endl;
			flag1 = 1;
		}
	}
	if (flag1 == 0)
		cout << "NOT FOUND" << endl;
		
	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;
}
/*
*@author: ??? 1100012986
*@date?2011.12.07
*@description???????
*/
int main()
{
	int  i, n, x, y;
	int a[100000] = {0};
	cin >> n;
    while(1) // ???????????????????????
	{
		cin >> x >> y;
		if(x == 0 && y == 0)
		{
			break;
		}
		a[y]++;
	}
	for(i = 0; i < n; i++) // ??????
	{
		if(*(a + i) == n - 1)
		{
			cout << i << endl;
			break;
		}
	}
	if(i == n) // ??????????NOT FOUND
	{
		cout << "NOT FOUND" << endl;
	}
	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");
		   
}
main()
{
      int n;
      int x[200000],y[200000];
      int i,j,k;
      scanf("%d",&n);
      do
      {
                     scanf("%d %d",&i,&j);
                     x[i]++;
                     y[j]++;
      }
      while(i!=0||j!=0);
      for(k=0;k<n;k++)
      {
                      if(x[k]==0&&y[k]==n-1)
                      {
                                            printf("%d",k);
                                            break;
                      }
                      if(k==n)
                              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,a[10002],b[10002],t[10002]={0},i,j,e;
	scanf("%d",&n);
	for(e=0;;e++)
	{
		scanf("%d %d",&a[e],&b[e]);
		if(a[e]==0&&b[e]==0)
		break;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<e;j++)
		{
			if(a[j]!=i&&b[j]==i)
			t[i]++;
		}
	}
	for(i=0;i<n;i++)
	{
		if(t[i]==n-1)
		{
			printf("%d\n",i);
			break;
		}
		else if(t[i]!=n-1&&i==n-1)
		printf("NOT FOUND");
	}
}
main()
{
  int n ,a[50000][2],b[50000],c[50000],k=0,t=0;
  for(int i=0;i<50000;i++)
  {
      b[i]=0;
      c[i]=0;
  }
  scanf("%d",&n);
  for(int i=0;;i++)
  {
      scanf("%d %d",&a[i][0],&a[i][1]);
      if(a[i][0]==a[i][1]) break;
      else k++;
  }
  for(int i=0;i<k;i++)
   {
       for(int j=0;j<n;j++)
       {
               if(a[i][1]==j) b[j]++;
               if(a[i][0]==j) c[j]++;
       }
   }
   for(int i=0;i<n;i++)
   {
           if(b[i]==n-1&&c[i]==0) printf("%d",i);
           else t++;
   }
   if(t==n) printf("NOT FOUND");
}
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();
}
main()
{
    int n,i,c,d,j;
    scanf("%d",&n);
    int b[n];
    i=0;
    do
    {
        b[i]=0;
        i=i+1;
    }
    while(i<n);
    do
    {
       scanf("%d %d",&c,&d);
       if(c!=0||d!=0)
       {
           i=0;
           b[d]=b[d]+1;
           b[c]=0;
       }
    }
    while(c!=0||d!=0);
    i=0;
    j=0;
    do
    {
       if(b[i]==(n-1))
       {
           printf("%d\n",i);
           j=1;
           break;
       }
       i=i+1;
    }
    while(i<n);
    if(j==0) printf("NOT FOUND");
}
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();
}
main()
{
      int i,j,n,k,l,sum,c,d;
      scanf("%d",&n);
      int*a=(int*)malloc(n*sizeof(int));
      int*b=(int*)malloc(n*sizeof(int));
      for(k=0;k<n;k++)
      {
          a[k]=0;b[k]=0;
      }
      for(i=0;;i++)
      {
                   scanf("%d %d",&c,&d);
                   a[c]++;
                   b[d]++;                   
                   if(c==0&&d==0)
                   break;
      }
      sum=0;
      for(j=0;j<=n-1;j++)
      {
                        if(a[j]==0&&b[j]==n-1)
                        {
                             printf("%d",j);
                             sum++;
                        }
      }
      if(sum==0)
      printf("NOT FOUND");
}
int main()
{
	int n,i=0,sum,r,j,f;
	int a[100000][2];
	int b[100000];
	scanf("%d",&n);
	sum=0;
	r=0;
	f=0;
	for(i=0;i<10000;i++)
	{
		b[i]=0;
	}
	for(i=0;i<10000;i++)
	{
		for(j=0;j<2;j++)
		{
			a[i][j]=-1;
		}
	}
	for(i=0;;i++)
	{
		for(j=0;j<2;j++)
		{
		    scanf("%d",&a[i][j]);
			if(j==1)
			{
				sum++;
			    if(a[i][0]==0&&a[i][1]==0)
				    break;
			}
		}
        if(a[i][0]==0&&a[i][1]==0)
				break;
	}
	for(i=0;i<sum-1;i++)
	{
		for(j=0;j<n;j++)
		{
			if(a[i][1]==j)
			{
				b[j]++;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(b[i]==n-1)
		{
			for(j=0;j<sum-1;j++)
			{
				if(a[j][0]==i)
				{
					r++;
				}
			}
     		if(r==0)
			{
		    	b[i]=-1;
			    f++;
			}
		    r=0;
		}
	}
	if(f==0)
		printf("NOT FOUND");
	else
	{
	    for(i=0;i<n;i++)
		{
	 	    if(b[i]==-1)
			{
			    printf("%d\n",i);
			}
		}
	}
	return 0;
}
int a[9999][9999] = {0}, b[9999] = {0}, recognize[9999] = {0};
int (*p)[9999], *r, *s;

int main()
{
	int n, t, k, i, j, flag = 0;
	p = a;
	r = b;
	s = recognize;
	cin >> n;
	while(1)
	{
		cin >> t >> k;
		if (t == 0 && k == 0)
			break;
		*(*(p + t) + k) = 1;
	}
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
		{
			if (*(*(p + i) + j) == 1)
			{
				(*(r + j))++;
				(*(s + i))++;
			}
		}
	for (i = 0; i < n; i++)
	{
		if ((*(r + i) == n - 1) && (*(s + i) == 0))
		{
			cout << i;
			flag = 1;
		}
	}
	if (flag == 0)
		cout << "NOT FOUND";
	return 0;
}
main()
{
      int i,j,n,k,l,sum,b;
      scanf("%d",&n);
      int a[100000][2];
       for(i=0;i<100000;i++)
      {
          for(j=0;j<2;j++)
          a[i][j]=0;
      }

      for(i=0;;i++)
      {
                   scanf("%d%d",&a[i][0],&a[i][1]);
                   if(a[i][0]==0&&a[i][1]==0)
                   break;
      }
      int c[n];
      for(j=0;j<n;j++)
      c[j]=0;
      for(k=0;k<=i-1;k++)
      {
                    b=a[k][1];
                    c[b]++;
      }
      sum=0;
      for(j=0;j<=n-1;j++)
      {
                        if(c[j]==n-1)
                        {
                             printf("%d",j);
                             sum++;
                        }
      }
      if(sum==0)
      printf("NOT FOUND");
}
/*
 * 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;

		}
	}
}
int main()
{
	int a[10000],b[10000];
	int i,n,j,k,p,q;
	int flag=0;
	scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		a[k]=0;
		b[k]=0;
	}

	for(q=0;;q++)
	{
		scanf("%d %d",&i,&j);
		if(i==0&&j==0)
			break;
		else
		{
			a[i]++;
			b[j]++;
		}
	}
	for(p=0;p<n;p++)
	{
		if((a[p]==0)&&(b[p]==n-1))
		{
			flag=1;
			printf("%d\n",p);
		}
	}
	if(flag==0)
		printf("NOT FOUND");
	return 0;
	
}
int main(){
	int i,j,n,re;
	int a[10000];
	int b[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		a[i]=0;
		b[i]=0;
		}
	while(1){
		scanf("%d%d",&i,&j);
		if(i==0&&j==0){
			break;
			}
		else{
			a[j]++;
			b[i]++;
			}
		}
	re=1;
	for(i=0;i<n;i++){
		if(a[i]==n-1&&b[i]==0){
			re*=0;
			}
		}
	if(re==1){printf("NOT FOUND");}
	else{
		for(i=0;i<n;i++){
			if(a[i]==n-1&&b[i]==0){
				printf("%d\n",i);
				}
			}
		}
	scanf("%d",&n);
	return 0;
	}
int main()
{int n,k,l=0,i[100000],j[100000],a[10000],b=0;
 scanf("%d",&n);
 for( k=0;k<=100000;k++)
 {
   scanf("%d %d",&i[k],&j[k]);
   if((i[k]==0)&&(j[k]==0))
   {
    {break;}
    }
 }

for(int m=0;m<=n-1;m++)
 {
  for(int w=0;w<=k-1;w++)
   {
    if(j[w]==m){b++;}
    if(i[w]==m) {b=0;{break;}}
   }
   if(b==n-1) 
   {b=0;l++;printf("%d\n",m);}
 }

 if(l==0){printf("NOT FOUND");}
 int v;scanf("%d",&v);
 return 0;

 
}
main()
{
    int n;
    int i,j;
    int t=0;
    int a[100000];
    int b[100000];
    int c[100000]={0};
    int d[100000]={0};
    scanf("%d",&n);
    scanf("%d %d",&a[0],&b[0]);
    i=0;
    while(a[i]!=0||b[i]!=0)
    {
        i++;
        scanf("%d %d",&a[i],&b[i]);
    }
    for(j=0;j<i;j++)
    {
        c[a[j]]++;
    }
    for(j=0;j<i;j++)
    {
        d[b[j]]++;
    }
    for(j=0;j<n;j++)
    {
        if(c[j]==0&&d[j]>=n-1)
        {
            printf("%d",j);
            t=1;
        }
    }
    if(t==0)
    printf("NOT FOUND");
}
int main()
{
    int n,t,i,j,k,cnt=0,cnt1=0,cnt2=0;
    scanf("%d",&n);
    t=10*n;
    int a[t],b[t];
    for(i=0;i<t;i++)
    {
        scanf("%d %d",&a[i],&b[i]);
        if((a[i]==0)&&(b[i]==0))
            break;
        else
            cnt++;
    }
    for(j=0;j<n;j++)
    {
        for(i=0,k=0;i<cnt,k<cnt;i++,k++)
        {
            if(a[i]==j)
                cnt1++;
            if(b[k]==j)
                cnt2++;
        }
        if((cnt1==0)&&(cnt2==n-1))
        {
            printf("%d\n",j);
            break;
        }
        cnt1=0;
        cnt2=0;        
    }
    if((cnt1==0)&&(cnt2==0))
    printf("NOT FOUND\n");
    getchar();
    getchar();
    getchar();
    getchar();
}
main()
{
  int i,k,n,c,d;
  int a[10000];
  int b[10000];
  k=0;
  scanf("%d",&n);
for(i=0;i<n;i++)
{   a[i]=1;b[i]=0;
}
  for(;;)
{  scanf("%d %d",&c,&d);
   if(c==0&&d==0) break;
     a[c]=0;  b[d]=b[d]+1;
     }
  
   for(i=0;i<n;i++)
   if(a[i]==1&&b[i]==n-1)
  {     k=1;
      printf("%d",i);
  } 
   if(k==0)
   printf("NOT FOUND");
    getchar();
   getchar();
      }
/**
  *file  ????
  *author ???
  *date   12.10
  *function		?n??????????????????????????????? 
???????????????????????????????????????????? 
????????O(n)????
*/
int main()
{
	int n, a[10000], b[10000], i, j, flag = 0;						//a[i]?????i???????????b[i]??????????i?????
	cin >> n;
	memset(a,0,10000);memset(b,0,10000);
	while(1)
	{
		cin >> i >> j;
		if(i == 0 && j == 0)
		{
			break;
		}
		else
		{
			a[i]++;
			b[j]++;
		}
	}
	for(i = 0; i < n; i++)
	{
		if(a[i] == 0 && b[i] == n-1)
		{
			cout << i << endl;
			flag = 1;
		}
	}
	if(flag == 0)
	{
		cout << "NOT FOUND" << endl;
	}
	return 0;
}
int a[9001][9001]={0};
int main()
{
	int n,p,q,flag=0;
	cin >> n;
	for (p=0;p<n;p++)
	{
		a[p][p]=1;
	}
	while (cin >> p >> q)
	{
		if (p!=0 || q!=0)
			a[p][q]=1;
		else break;
	}
	for (p=0;p<n;p++)
	{
		int count=0;
		for (q=0;q<n;q++)
		{
			if ((p==q)||(p!=q&&a[q][p]==1&&a[p][q]==0))
				count++;
		}
		if (count==n)
		{
			cout << p << endl;
			flag=1;
		}
	}
	if (flag==0)
		cout << "NOT FOUND" << endl;
	return 0;
}
main()
{
      int n,a,b,i,c[10000],d[10000],t;
      scanf ("%d",&n);
      for (i=0;i<n;i++)
      c[i]=0;
      d[i]=0;
      scanf ("%d %d",&a,&b);
      for (;(a!=0)||(b!=0);)
      {    
           c[b]=c[b]+1;
           d[a]=d[a]+1;
           scanf ("%d %d",&a,&b);
      }
      t=0;
      for(i=0;i<n;i++)
      {
           if ((c[i]==(n-1))&&(d[i]==0))
           {  
              printf("%d",i);
              t=1;
           }
           if (t==1)  break;
      }
      if (t==0)  printf("NOT FOUND"); 
                
      

}
int main()
{
   int n,a[100000],b[100000],i,j,m,s,k,p,v;
   scanf("%d",&n);
   for(i=0;;i++)
   {
      scanf("%d %d",&a[i],&b[i]);  
      if(a[i]==0&&b[i]==0)break;
      }
      i=i-1;
      v=0;
   for(j=0;j<=i;j++)
   {
                    m=b[j];
                    s=0;
                    for(k=0;k<=i;k++)
                    { 
                                     if(b[k]==m)
                                     s=s+1;
                                     }
                    if(s==n-1)
                    {
                              for(p=0;p<=i;p++)
                              {
                                               if(a[p]==m)break;
                                               }
                              if(p==i+1)
                              {
                                v=1;
                                printf("%d",m);
                                break;
                                }
                    }
   }
   if(v==0)
   printf("NOT FOUND");
   getchar();
   getchar();
}
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 i,j,a,b,c,d,e,f;
      int g[100000]; 
      scanf("%d",&a);
      for (i=0;i<a;i++)
      g[i]=1;
      for (i=0;i<100000;i++)
      {
          scanf("%d %d",&b,&c);
          if (b==0 && c==0)
          break;
          g[b]=-a;
          g[c]++;
      }
      d=0;
      for (i=0;i<a;i++)
      {
          if (g[i]==a)
          {
                      printf("%d",i);
                      d++;
                      
          }
      }
      if (d==0)
      printf("NOT FOUND");
      getchar ();
      
}
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 main()
{
	int n=0,a[10000]={0},b[10000]={0},i;
	cin >>n;
	for(i=0;;i++)
	{
		int p,q;
		cin >>p >>q;
		if(p==0&&q==0)
			break;
		else{
		    a[p]=1;
		    b[q]=b[q]+1;
		}
	}
	for(i=0;i<n;i++)
		if(a[i]==0&&b[i]==n-1)
		{
			cout <<i <<endl;
			break;
		}
	if(i==n)
		cout <<"NOT FOUND" <<endl;
	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();
}
main()
{
         int n;
         int i,j=0;
         int x,y;
         int mingliu=-2;
         int p[100000][2];
         scanf("%d",&n);
         for(i=0;;i++)
         {
                  for(j=0;j<2;j++)
                  scanf("%d",&p[i][j]);
                  if(p[i][0]==0&&p[i][1]==0)
                  break;
         }
            for(y=0;y<i;y++)
         {
                  for(x=0;x<i;x++)
                  {


                                    if(p[y][1]==p[x][0])
                           {
                                    y=y+1;
                                    x=0;
                           }
                           else if (p[y][1]!=p[x][0]&&p[x][1]==p[y][1])
                            j=j+1;
                  }


                           if(j==n-1)
                           {
                           mingliu=p[y][1];
                           break;
                           }
                           else j=0;

         }
         if (mingliu==-2)
         printf("NOT FOUND");
         else printf("%d",mingliu);
}
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;
}
//********************************
//* ???12.7??????   **
//* ??:?? ???1000012888  **
//********************************
int main()
{
    int n, i, j, t, b, k, c;
    cin >> n;
    int a[100000][2];
    i = 0;
    cin >> a[i][0] >> a[i][1];
    while ((a[i][0] + a[i][1])!= 0)
    {
          i = i + 1;
          cin >> a[i][0] >> a[i][1];
    }
    t = i - 1;
    for (j = 0; j <= n - 1; j++)
    {
          b = 0;
          for (i = 0; i <= t; i++)
          {
                if (a[i][0] == j) 
                {
                            b = 1;
                            break;
                
                }
          }
          if(b == 0)
          {
               k = j;
               break; 
          }
    }
   c = 0;
   for (i = 0; i <= t; i++)
   {
       if (a[i][1] == k)
       c = c + 1;
   }
   if (c == n - 1)
   cout << k << endl;
   else 
   cout << "NOT FOUND" << endl;
   return 0;
}
int main()
{
	int n,a[25000][2],i,b[25000][2]={0},k=0;
	scanf("%d",&n);
	scanf("%d %d",&a[0][0],&a[0][1]);
	i=1;
	while(a[i-1][0]!=0||a[i-1][1]!=0)
	{
		scanf("%d %d",&a[i][0],&a[i][1]);
		i++;
	}
	i=0;
	while(a[i][0]!=0||a[i][1]!=0)
	{
		b[a[i][0]][0]++;
		b[a[i][1]][1]++;
		i++;
	}
	for(i=0;i<n;i++)
	{
		if(b[i][0]==0&&b[i][1]==n-1)
		{
			printf("%d\n",i);
			k++;
		}
	}
	if(k==0) printf("NOT FOUND");
}
int main()
{
    int a[10000] = {0};
    int b[10000] = {0};
    int n;
    cin >> n;
    int i, j;
    while ( cin >> i >> j)
   {
       if (i==0 && j==0)  break;
       a[i]++;
       b[j]++;
   }
   for (i = 0; i<n; i++)
      if (a[i] == 0 && b[i] == n-1)
      {
          cout << i << endl;
          break;
      }
  if (i==n) cout << "NOT FOUND" << endl;
    return 0;
}
int main()
{
	int a[300000],b[300000],count[350]={0},i=0,n;
	scanf("%d",&n);
	scanf("%d %d",&a[0],&b[0]);
	while(a[i]!=0||b[i]!=0)
	{
		count[a[i]]=-1;
		count[b[i]]++;
		i=i+1;
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<n;i++)
	{
		if(count[i]>=n-1)
		{
			printf("%d",i);
		    return 0;
		}
	}
		printf("NOT FOUND\n");
	return 0;
}
int main()
{
	int n,count=0,count1=0,i=-1,j=0;
	int a[1000000]={0},b[1000000]={0},x[10000]={0};
	cin>>n;
	do
	{
		i++;
		cin>>a[i]>>b[i];
		count++;
	}while(a[i]!=0||b[i]!=0);
	for(i=0;i<n;i++)
		for(j=0;j<count;j++)
			if(b[j]==i&&(a[j]!=0||b[j]!=0))
				x[i]++;
	for(i=0;i<n;i++)
		if(x[i]>=n-1)
		{
			cout<<i;
			count1++;
		}
	if(count1==0)
		cout<<"NOT FOUND"<<endl;
	return 0;
}
int main()
{
    int know[10000]={0},beknown[10000]={0};
    int n=0,i,x,y,flag,t;
    scanf("%d",&n);
    x=y=1;
    t=0;
    while(x+y!=0)
    {
        scanf("%d %d",&x,&y);
        know[x]++;
        beknown[y]++;
    }
    flag=0;
    for (i=0;i<n;i++)
    {
        if ((know[i]==0)&&(beknown[i]==n-1)){flag=1;t=i;}
    }
    if (flag==1) printf("%d",t);
    else {
        printf("NOT FOUND");
    }
        
}