semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n;
	int a[10000], b[10000], sumA[10000] = {0}, sumB[10000] = {0}, flag = 0;
	cin >> n;
	int s = 0;
	cin >> a[s] >> b[s];
	while (a[s] != 0 || b[s] != 0)
	{
        sumA[a[s]]++;
        sumB[b[s]]++;
		s++;
		cin >> a[s] >> b[s];
	}
	for (int i = 0; i < n; i++)
	{
		if (sumA[i] == 0 && sumB[i] != 0)
		{
			cout << i << endl;
			flag = 1;
		}
	}
	if (!flag)
	{
		cout << "NOT FOUND" << endl;
	}

	return 0;
}
int main(){
    int n,m,i,j,k,know[10000],known[10000],x,y,z;
    scanf("%d",&n);
    m=0;
    z=0;
    for(i=0;i<10000;i++){
        scanf("%d",&know[i]);
        scanf("%d",&known[i]);
        m=i;
        if(know[i]==0&&known[i]==0)
            break;
    }
    for(i=0;i<n;i++){
        x=0;
        y=0;
        for(j=0;j<m;j++){
            if(i==know[j])
                x++;
            if(i==known[j])
                y++;
        }
        if(x==0&&y==n-1){
            printf("%d\n",i);
            z=1;
        }
    }
    if(z==0)
    printf("NOT FOUND\n");
    return 0;
    }
main()
{
    int x[10000][2];
    int n,i,a,b;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        x[i-1][1]=0;
        x[i-1][2]=0;
    }
    for(;;)
    {
        scanf("%d %d",&a,&b);
        if(a==0&&b==0)
        break;
        x[b][1]=x[b][1]+1;
        x[a][2]=x[a][2]+1;
    }
    for(i=0;i<=n-1;i++)
    {
        if(x[i][1]==n-1&&x[i][2]==0)
        {
            printf("%d",i);
            break;
        }
    }
    if(i==n)
    printf("NOT FOUND");
}
main()
{
      int a[100000],b[100000],n,i,l,rs=1,br=0,shml;
      scanf("%d",&n);
      shml=n-1;
      for(i=0;;i++)
      {
              scanf("%d %d",&a[i],&b[i]);
              if(a[i]==b[i])
              break;
      }
      l=i+1;
      if(a[0]!=0)
      shml=0;
      for(i=1;i<l;i++)
      {
                      if(a[i]!=a[i-1])
                      {
                                      rs++;
                                      if(a[i]==a[i-1]+2)
                                      shml=a[i-1]+1;
                      }
      }
      printf("%d",shml);
}
int main()
{
    int n,i,j,flag=0;
    scanf("%d",&n);
    int a[n],b[n];
    for(i=0;i<n;i++) {a[i]=0;b[i]=0;}
    scanf("%d %d",&i,&j);
    for(;i!=0||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);flag=1;break;}
    }
    if(flag==0) printf("NOT FOUND");
    return 0;
}
int a[5000000];
int b[5000000];
int n=0;
int l=0,r=0;
int main()
{
    //freopen("zozo.in","r",stdin);
    //freopen("zozo.out","w",stdout);
    scanf("%d",&n);
    for (int i=1; i<=n; i++) { a[i]=0; b[i]=0; }
    scanf("%d%d",&l,&r);
    while (!(l==0 && r==0))
    {
      l++;  r++;
      b[r]++; a[l]=1;
      scanf("%d%d",&l,&r);
    }
    int flag=0;
    for (int i=1; i<=n; i++)
        if (a[i]==0 && b[i]==n-1)
        {
          flag=1; printf("%d\n",i-1);
        }
    if (flag==0) printf("NOT FOUND\n");
    return 0;
}
int main()
{
    int i,n,p,count=0,e=0;
    int a[10000],b[10000],c[10000],d[10000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    c[i]=0;
    }
    for(i=0;i<10000;i++)
    {
                        scanf("%d %d",&a[i],&b[i]);
                        e++;
                        if(a[i]==0&&b[i]==0)
                        break;
    }
    for(i=0;i<e;i++)
    {
                    p=b[i];
                    c[p]++;
                    p=a[i];
                    c[p]=-10000;
    }
    for(i=0;i<n;i++)
    {
                    if(c[i]==n-1)
                    {
                               printf("%d\n",i);
                               count=1;
                    }
    }
    if(count==0)
    {
                printf("NOT FOUND");
    }
    return 0;
}
int main()
{
	int n, a[100000] = {0}, b[100000] = {0},c[10000] = {0}, i = 0, flag1 = 0, j = 0, flag2 = 0;
	int *p = NULL, *q = NULL;
	cin >> n;
	cin >> a[0] >> b[0];
	while ((a[i] != 0) || (b[i] != 0))
	{
		i++;
		cin >> a[i] >> b[i];
	}
	for (p = &b[0], q = &b[i]; ; p++)
	{
		if (p == q)
			break;
		c[*p]++;
	}
	for (p = &c[0]; ; p++, j++)
	{
		if (*p == n - 1)
		{
			flag1 = 1;
			break;
		}
		if (j == n)
			break;
	}
	if (flag1)
	{
		for (p = &a[0], q = &a[i]; p != q; p++)
		{
			if (*p == j)
			{
				flag2 = 1;
				break;
			}
		}
	}
	if ((flag2 == 0)&&(flag1 == 1))
		cout << j;
	else 
		cout << "NOT FOUND";
	return 0;
}
main()
{
int n,a[100000][2],i,m,t=0,j,k=0,c[1000],d[100000];
scanf("%d",&n);
for(i=0;;i++)
{
             scanf("%d%d",&a[i][0],&a[i][1]);
             if(a[i][0]==0&&a[i][1]==0)
             break;}
 m=i-1;
 for(i=0;i<n;i++)
 {
   for(j=0;j<=m;j++)
   {
     if(i==a[j][0])
     break;
     else if(j==m)
     { t++;
     c[t]=i;
     } 
   }
 } 
if(t==1)
{
 for(j=0;j<=m;j++)
 {
  if(c[1]==a[j][1])
  {d[k]=a[j][0];
  k++;}
 }
 t=0;
 for(i=0;i<n;i++)
 {
   for(j=0;j<k;j++)
   {
     if(i==d[j])
     break;
     else if(j==k-1)
     { t++;
     } 
   }
 } 
 if(t==1)
 printf("%d",c[1]);
 else printf("NOT FOUND");
}
else printf("N0T FOUND");
}
int in[100000],out[100000];


int main()
{
	int n,x,y;
	scanf("%d",&n);
	while (scanf("%d %d",&x, &y), (x!=0)||(y!=0))
	{
		out[x]++;
		in[y]++;
	}

	int find=0;
	for (int i=0;i<n;i++)
	if (in[i]==n-1 && out[i]==0)
	{
		printf("%d\n",i);
		find = 1;
	}
	if (!find)
		printf("NOT FOUND\n");
	return 0;
}
int main()
{
	int n, m = 0;										//???????n?????m?????????
	cin >> n;
	int i, j, k = 0;		
	int a[1000000], b[1000000] = {0};					//??????,????????????????????
	cin >> i >> j;										//?????i?j???i??j
	int *p = a;											//??????????????a????
	*p = j;											    //?a[1]??j
	b[0] = 1;											//????
	while (1)											//????
	{
		int flag1 = 0;
		cin >> i >> j;
		if (i == 0 && j == 0)					       //??????0??????
			break;
		else
		{
			for (m = 0; m <= k; m++)
			{
				if (*(p + m) == j)					  //?????j??
				{
					b[m] ++;						 //??????1
					flag1 = 1;						 //???1
					break;							
				}
				
			}
			if (flag1 == 0)							//??????????????????
			{
				*(p + k + 1) = j;					//?????????????
				b[++k]++;							//??????1
			}
		}
	}
	int flag2 = 0;
	for (m = 0; m <= k; m++)
	{
		if (b[m] == n - 1)							//??????n-1?????????????
		{
			cout << *(p + m);						//??????
			flag2 = 1;
			break;
		}
	}
	if (flag2 == 0)									//????????
		cout << "NOT FOUND" << endl;		        
	return 0;
}
main()
{
    int m[10000]={0};
    int n[10000]={0};
    int x,y;
    int s;
    scanf("%d",&s);
    for(;;)
    {
        scanf("%d %d",&x,&y);
        if(x==0&&y==0)
        break;
        m[x]++;
        n[y]++;
    }
    for(x=0;x<s;x++)
    y=0;
    for(x=0;x<s;x++)
    {
        if(m[x]==0&&n[x]==s-1)
        {
            y++;
            printf("%d",x);
        }
    }
    if(y==0)
    printf("NOT FOUND");
}
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;
}
//**************************
//??????? 
//??????1200012914 
//???2012.12.11
//**************************


int main()
{
    struct count
    {
        int knowshim; //???????? 
        int heknows; //???????? 
    } person[10000];
    int num; //???
    cin >> num; //?????
    int i;
    for (i = 0; i < num; i++)
    {
        person[i].knowshim = 0;
        person[i].heknows = 0;
    } //?person???????????0 
    int who, whom; //who????whom??????
    int flag = 0;
    while (1)
    {
        cin >> who >> whom;
        if (who + whom == 0) break; //???0 0?????
        person[who].heknows++;
        person[whom].knowshim++;
    }
    for (i = 0; i < num; i++)
    {
         //??????????0????????num-1?????? 
         if (person[i].heknows == 0 && person[i].knowshim == num - 1)
         {
             flag = 1;
             cout << i << endl;
         }
    }
    if (!flag) cout << "NOT FOUND" << endl; //???????not found

    return 0;
}
int main()
{
	int man[2][1000000]={0},a,b,n,flag=0,*p,*q;
	p=man[0];
	q=man[1];
	cin>>n;
	while(cin>>a)
	{
		cin>>b;
		if(a==0&&b==0)
			break;
		man[0][a]++;
		man[1][b]++;
	}
	for (int i=0;i<n;i++)
	{
		if(*p==0&&*q==n-1)
		{
			cout<<i<<endl;
			flag=1;
		}
		p++;
		q++;
	}
	if (flag==0)
		cout<<"NOT FOUND"<<endl;
	return 0;
}
int k[10000][10000];
int main()
{
	int n,x,y,flag,i,j,pre;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<1000;j++)
		{
			k[i][j]=0;
		}
	}
	cin>>n;
	while((cin>>x>>y)&&(x!=0||y!=0))
	{
		k[x][y]=1;
	}
	pre=0;
	for(i=1;i<n;i++)
	{
		if(k[pre][i]==1)
			pre=i;
	}
	flag=1;
	for(i=0;i<n;i++)
	{
		if(i!=pre)
		{
			if(k[pre][i]==1)
			{
				flag=0;
				break;
			}
		}
	}
	if(flag==0)
		cout<<"NOT FOUND"<<endl;
	else
		cout<<pre<<endl;
	return 0;
}
int main(){
	int know[10000];
	int known[10000];
	int i,j,n,k=0;
	int a,b,time;
	scanf("%d",&n);
	time=n*(n-1);
	for(i=0;i<n;i++){
		know[i]=0;
		known[i]=0;
	}
	for(i=0;i<time;i++){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
		   break;
		}else{
		   know[a]++;
		   known[b]++;
		}
	}
	for(i=0;i<n;i++){
		if(know[i]==0&&known[i]==(n-1)){
			printf("%d\n",i);
			k++;
		}
	}
	if(k==0){
		printf("NOT FOUND");
	}
	return 0;
}
int main()
{
    int a[100000],b[100000],k[100000];
    long N,i,j=0,n,x;
    scanf("%d",&N);
    for(i=0;i<=100000;i++)
    {
                         scanf("%d%d",&a[i],&b[i]);
                         if(a[i]==0&&b[i]==0)
                         {
                              x=i-1;               
                              break;
                         }
                         else
                         ;
    }
    for (i=0;i<=x;i++)
    {
        for(n=0;n<N;n++)
        {
                         if(b[i]==n)
                            k[n]++;
                         
                           
        }
    }
    for (n=0;n<N;n++)
    {
        if(k[n]==N-1)
        printf("%d",n);
        else
        ;
    }
    
    

  return 0;
}
main()
{
      int n,i,j,k,l;
      int *a,*b;
      scanf("%d",&n);
      a=(int *)malloc(n*sizeof(int));
      b=(int *)malloc(n*sizeof(int));
      for(i=0;i<n;i++)
      {
                      a[i]=0;
                      b[i]=0;
      }
      k=0;
      l=1;
      while(k!=0||l!=0)
      {
                             scanf("%d %d",&k,&l);
                             if(k==0&&l==0) break;
                             a[k]=1;
                             b[l]=1;
      }
      k=0;
      for(i=0;i<n;i++)
           if(a[i]==0&&b[i]==1)
                      {
                        printf("%d\n",i);
                        k++;
                        }
      if(k==0)    printf("NOT FOUND");
}
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;
}
main ()
{
     int n,i,c,f,g=0;
     scanf ("%d",&n);
     int a[n];
     for (i=0;i<n;i++)
     a[i]=i;
     while (10)
     {
       scanf ("%d %d",&c,&f);
       if (c==0&&f==0)
       break;
       else 
       a[c]=-1;
       }
       for (i=0;i<n;i++)
       {
           if (a[i]!=-1)
          {
            printf ("%d\n",a[i]);
           g++;
           }
       }
       if (g==0)
       printf ("NOT FOUND");
       getchar ();
       getchar ();
     }
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;
}
// ?????? ?? 1000062708
int main()
{
	int n, i, j, a[100000] = {0};
	cin >> n;
	do
	{
		cin >> i >> j;
		a[i]--;
		a[j]++;
	}while(i != 0 || j != 0);
	for(i = 0;i < n;i++)
		if(a[i] == n - 1)
		{
			cout << i << endl;
			break;
		}
	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,i,a,b,j,k=0;
    int x[10000]={0},y[10000]={0};
    scanf("%d",&n);
    for(i=0;i<n*(n-1);i++)
    {
                          scanf("%d %d",&a,&b);
                          if(a==0&&b==0)
                          {
                                        break;             
                          }
                          else
                          {
                                        x[a]++;
                                        y[b]++;                          
                          }                      
    }
    for(j=0;j<n;j++)
    {
                    if(x[j]==0&&y[j]==n-1)
                    {
                                          printf("%d",j);
                                          k=k+1;
                    }                
    }
    if(k==0)
    printf("NOT FOUND");
}
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");}
}
main()
{
	int n,i,j,a,b,k=0;
	int x[10000],y[10000];
	scanf("%d",&n);
	for(i=0;i<n*(n-1);i++)
	{
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)
		{break;}
		else
		{
		x[a]++;
		y[b]++;
	}
	}
	for(j=0;j<n;j++)
	{
		
		if(x[j]==0&&y[j]==n-1)
		{printf("%d",j);
		k+=1;}
	}
	if(k==0)
	printf("NOT FOUND");
}
/*
 * qimomoni_1.cpp
 *    3
 *  Created on: 2011-1-8
 *      Author: ???
 */

int main(){
	struct person{
		int a;		//a ????????b????????
		int b;
	}p[10000];
	int i,g=0;
	int a1,a2;
	int n;
	cin>>n;
	for(i=0;i<n;i++)
		{p[i].a=0;
		p[i].b=0;}
	while(1){
		cin>>a1>>a2;
		if((a1==0)&&(a2==0))
			break;
		p[a1].a++;
		p[a2].b++;
	}
         g=0;
	for(i=0;i<n;i++)
		if((p[i].b==n-1)&&(p[i].a==0))
			{cout<<i<<endl;
			g=1;
			break;}
	if(g==0) cout<<"NOT FOUND"<<endl;
	return 0;
}
int main()
{   
    int n,i,j,l,b;
    int s[10000];
    scanf("%d",&n);
    scanf("%d %d",&i,&j);
    b=0;
    for (l=0;l<n;l++)
        s[l]=0;
    while ((i!=0)||(j!=0))
          {
                         s[j]++;
                         if (s[j]==n-1)
                         {
                            printf("%d\n",j);
                            b++;
                         }
          scanf("%d %d",&i,&j);
          }
    if (b==0)
       printf("NOT FOUND");
}
int main(){
    int n,i,j,p,q,k;
    cin>>n;
    int a[100000][2];
    for(i=0;;i++){
    	for(j=0;j<2;j++)
    		cin>>a[i][j];
        if(a[i][0]+a[i][1]==0)
            break;}  //??????
    int b[100000];
    for(p=0;p<i;p++)
    	    for(q=0;q<n;q++){
    	    	if(a[p][1]==q)
    	    		b[q]++;  //??????
    	    }
    k=0;
    for(q=0;q<n;q++)
    	if(b[q]==n-1){
    		cout<<q<<endl;
    		k=1;
    		break;
    	}
    if(k==0)
    	cout<<"NOT FOUND"<<endl;
    return 0;
}
//******************************************
//*?????????.cpp                 **
//*??: ??     1100012808              **
//*???2011.12.07                       **
//******************************************
int main()  //???
{        //?????
	int n, i, j, a[100000] = {0}, flag = 0;
	int*p = a;
	cin >> n;
	while (cin >> i)
	{
		cin >> j;
		if (i == 0 && j == 0)
			break;
		else 
			(*(p + 4 * j))++;
	}
	for (; p < (a + 4 * n); p = p + 4)
	{
		if (*p >= n - 1)
		{
			cout << (p - a) / 4 << endl;
			flag = 1;
		}
	}
	if (!flag)
		cout << "NOT FOUND" << endl;
	return 0;
} //?????
int main()
{
	int n, a[100000][2], i = 0, j = 0, k, b[100000] = {0}, count[100000] = {0}, t = 0;
	cin >> n;
	do
	{
		cin >> a[i][0] >> a[i][1];
		i++;
	}
	while(a[i - 1][0] != 0 || a[i - 1][1] != 0);        //????????????0
	k = i - 1;                                  //?????????
	for(i = 0; i < k; i++)
		b[a[i][0]]++;                           //????????????????
	while(j < n)
	{
		if(b[j] == 0)                           //????????????
		{
			for(i = 0; i < k; i++)
				if(a[i][1] == j)
					count[j]++;                 //??????????????????
			if(count[j] == n - 1)
			{
				t++;
				cout << j << endl;              //????????????????????
			}
			j++;
		}
		else
			j++;
	}
	if(t == 0)
		cout << "NOT FOUND" << endl;            //?????????????NOT FOUND
	return 0;
}
int a[10000];
int b[10000];
int main()
{
	int n,p,q,i;
	cin>>n;
	for(i=0;i<n;i++)
		a[i]=0;
    	cin>>p>>q;
	while(p!=0||q!=0)
	{	
		a[p]++;b[q]++;
		cin>>p>>q;
	}
	for(i=0;i<n;i++)
		if(a[i]==0&&b[i]==n-1)
		{cout<<i<<endl;return 0;}
			cout<<"NOT FOUND"<<endl;
			return 0;
		
}
main()
{
      int n;
      scanf("%d",&n);
      int a[n+1];
      for(int i=0;i<=n-1;i++)
      {
              a[i]=0;
      }
      int x=1,y=1;
      while(x!=0||y!=0)
      {
                       scanf("%d %d",&x,&y);
                       a[x]--;
                       a[y]++;
      }
      for(int i=0;i<=n-1;i++)
      {
              if(a[i]==n-1)
              printf("%d",i);
      }
}
//****************************************************
//*  ? ? ?: homework.cpp                          *
//*  ?    ?: ???                                *
//*  ????: 2012?12?10?                        *
//*  ????: ??????                          *
//****************************************************


int main()
{
	int a[10000] = {0}; //?????? 
	int i, j, n;
	cin >> n;
	cin >> i >> j;
	//?? 
	while ((i != 0) || (j != 0))
	{
		a[i] = -1; //??????????????? 
		a[j]++; //?????????+1 
		cin >> i >> j;
	}
	for (i = 0; i < n; i++)
		if (a[i] == n - 1) //??????N - 1??????? 
		{
			cout << i << endl;
			return 0;
		}
	cout << "NOT FOUND" << endl;
	return 0; 
}
int main()
{
	int n;
	int a=1000;
	int c[10000];
	int i;
	int k=0;
	scanf("%d",&n);
	for(int w=0;w<10000;w++)
		c[w]=0;
	int b=n;
	while(a!=0||b!=0)
	{
		c[b]++;
		scanf("%d%d",&a,&b);
	}
	for(int l=0;l<n;l++)
	{
			if(c[l]==n-1)
			{
				printf("%d",l);
				k=1;
				break;
			}
	}
	if(k==0)
		printf("NOT FOUND");
	return 0;
	}
main()
{
 int i,j,n;
 int*p,*q;
 scanf("%d",&n);
 p=(int*)malloc(n*sizeof(int));
 q=(int*)malloc(n*sizeof(int));
 for(i=0;i<n;i++)
 {
  *(p+i)=0;
  *(q+i)=0;               
}
                 int a,b;
                while(1)
                 {
                  scanf("%d %d",&a,&b);
                  if(a==0&&b==0) break;
                  else
                  {
                   *(p+a)=*(p+a)+1;
                   *(q+b)=*(q+b)+1;   
                      }         
                           }
                           int x[2];
                           x[0]=-1;
                           for(i=0;i<n;i++)
                           {
                            if(*(p+i)==0&&*(q+i)==n-1)
                            {x[0]=i;printf("%d",x[0]);break;}               
                                           } 
                                           if(x[0]==-1)
                                           printf("NOT FOUND\n");

      }
// ??????.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 i, j, k, n, flag, count, s = 0, a[100000] = {0}, b[100000] = {0};
	cin>>n;
	cin>>a[0]>>b[0];
	for(i = 0; a[i] != 0 || b[i] != 0; i++)
		cin>>a[i + 1]>>b[i + 1];
	for(j = 0; j < i; j++)
	{
		count = 1;
		for(k = j + 1; k < i; k++)
		{
			if(b[k] == -1)
				continue;
			if(b[k] == b[j])
			{
				b[k] = -1;
				count++;
			}
		}
		if(count == n - 1)
		{
			flag = 1;
			for(k = 0; k < i; k++)
			{
				if(a[k] == b[j])
				{
					flag = 0;
					break;
				}
			}
			if(flag)
			{
				s++;
			    cout<<b[j]<<endl;
			}
		}
	}
	if(s == 0)
		cout<<"NOT FOUND"<<endl;
	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 main()
{
    int n,i,a,b,c,d,e;
    int m[100000][2];
    scanf ("%d",&n);
    d=0;
    for (i=0;;i++)
    {
       scanf ("%d %d" ,&m[i][0],&m[i][1]);
       if ((m[i][0]==0)&&(m[i][1]==0))
        break;
      }
    for (c=0;c<n;c++)
    {
      b=0;
      for (a=0;a<i;a++)
       {
          if (m[a][1]==c)
            b++;
        }
      if (b==n-1)
        {
           for (e=0;e<i;e++)
           {
             if (m[e][0]==c)
              {
               d=2;
               break;
               }
            }
           if (d==0)
           {
            printf ("%d",c); 
            d=1;
            }
            break;
         }
      }
     if (d!=1)
        printf ("NOT FOUND");
     return 0;
}
//********************
//****??????****
//**?? 1100012915***
//*******12.13********
//********************
int main()
{
	int n, i, person1, person2 ;//n????i????????person1?2?????????
	int know[10000][2] = {0} ;	//???? ???????????????
	int *p ;
	int flag = 0 ;				//???????????
	p = &know[0][0] ;			//??p = know???...??????????
	cin >> n ;
	while ( 1 )
	{
		cin >> person1 >> person2 ;
		if ( ( person1 == 0 ) && ( person2 == 0 ) )
			break;				//??0 0?????
		*( p + person1 * 2 ) = *( p + person1 * 2 ) + 1 ;		//???????
		*( p + person2 * 2 +  1) = *( p + person2 * 2 + 1 ) + 1 ;//??ta?????
	}
	for ( i = 0 ; i <= n - 1 ; i++ )
		if ( ( *( p + i * 2 ) == 0 ) && ( *( p + i * 2 + 1 ) == n - 1 ) ) 
		{
			cout << i ;			//?????????????n-1????????????
			flag = 1 ;			//???????
		}
	if ( flag == 0 )
		cout << "NOT FOUND" ;	//?????"NOT FOUND"
	return 0;
}