semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
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;
        }


    }
   


}
int main()
{
	int n,i,j=1,k=1,s,a[10000]={0};
	
	scanf("%d",&n);

	
	for(;j!=0||k!=0;)
	{
		scanf("%d %d",&j,&k);
		a[k]++;
	}
	s=0;
	for(i=0;i<n;i++)
	{
		if(a[i]==n-1)
		{
			printf("%d\n",i);
			s=1;
			break;
		}
	}
	if(s=0)
		printf("NOT FOUND");

	return 0;
}
int main()
{
    int n,a[65535]={0},i,j,sum=0;
    scanf("%d",&n);
    if(n==1)
    printf("0\n");
    while(1)
    {
            scanf("%d %d",&i,&j);
            if(i==0&&j==0)
            break;
            else
            {
                a[i]--;
                a[j]++;
            }
    }
    for(i=0;i<n;i++)
    {
                    if(a[i]==(n-1))
                    {
                                   printf("%d",i);
                                   sum++;
                    }
    }
    if(sum==0)
    printf("NOT FOUND");
    getchar();
    getchar();
}
//****************************
//????1000012825         *
//??????               *
//???12.10                *
//?????????         *
//****************************
int main ()
{
	int n, i, j, k, p, flag = 0, a[100000][2], count[100000] = {0};
	cin >> n;     //???????
	for ( i = 0; ; i++ )
	{
		for ( j = 0; j < 2; j++ )
			cin >> a[i][j];			
		if ( a[i][0] == 0 && a[i][1] == 0 ) //?? 0.0 ?????
			break;
		else
			count[a[i][1]]++; //?????????
	}
	for ( k = 0; k <= n - 1; k++ )
	{
		if ( count[k] >= n - 1 ) //????????????????????
		{
			for ( p = 0; p < n; p++ )
				if ( a[p][0] == k )
					break;
			if ( p == n  ) //????????
			{	
				cout << k << endl;
				flag = 1;
			}
		}
	}
	if ( flag == 0 )
		cout << "NOT?FOUND" << endl; //????????
	return 0;
}
main()
{
      int n,a[100000],b[100000],c[10000],i,j,m;
      scanf("%d",&n);
      for(i=0;;i++)
      {
         scanf("%d %d",&a[i],&b[i]);
         if(a[i]==0&&b[i]==0)
         break;
      }
      m=i;
      for(i=0;i<m;i++)
      {
         for(j=0;j<n;j++)
         {
            if(b[i]==j)
            {
               c[j]++;
               break;
            }
         }
      }
      for(j=0;;j++)
      {
         if(c[j]==n-1)
         {
            printf("%d",j);
            break;
         }
         if(j==n-1)
            printf("NOT FOUND");
      }
      return 0;
}
int main()
{
    int i,j,k,num,a[10000],b[10000],famous;
    famous =0;
    scanf("%d",&num);
    for(k=0;k<num;k++)
    {
    a[k]=0;
    b[k]=0;
    } 
    scanf("%d %d",&i,&j);
    while(i!=0 || j!=0)
    {
      a[i]=a[i]+1;
      b[j]=b[j]+1;
      scanf("%d %d",&i,&j);
    }
     for(k=0;k<num;k++)
     {
       if(a[k]==0 && b[k] == num -1)
       {
       printf("%d",k);
       famous ++;
       }
     }
     if (famous == 0)
     printf("NOT FOUND");
  
     
}
int main()
{
      long int i,j,k,n,s,t,l,flag;
      int a[20000],b[20000],c[20000]; 
      
      scanf("%d",&n); 
      
      
      s=1;
      t=1;
      
      for(i=0;i<n;i++)
      c[i]=0;
      i=0; 
      while((s!=0)||(t!=0))
      {     scanf("%d %d",&a[i],&b[i]);
            
            s=a[i];
            t=b[i]; 
                                     
            i++;               
                           
      }
      
      l=i-1;
      
     
       for(i=0;i<l;i++)
         {     for (j=0;j<n;j++)
                {
                   if (b[i]==j)
                   c[j]++;
                                
                                
                                
                }
                       
                       
                       
                       
                       
                       
         }
    
    flag=0;
    for (i=0;i<n;i++)
   {     
          if(c[i]==n-1)
          {printf("%d",i);
           flag++;
          }
          
        
        
        }
        
    if(flag==0)
    printf("NOT FOUND");
    
    
    
    
    
    
    
    
    
    
    
    
    
    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");
      getchar();getchar();getchar();
}
int main()
{
	int n,a[1000000][2],i=0,j,p,renshi,sum=0;
	scanf("%d",&n);
	while(1)
	{
		
		scanf("%d%d",&a[i][0],&a[i][1]);
		if(a[i][0]==0&&a[i][1]==0)
		break;
		i++;
	}
	for(p=0;p<n;p++)
	{
		renshi=0;
		for(j=0;j<i;j++)
		{
			if(a[j][0]==p)break;
			if(a[j][1]==p)
			renshi++;	
		}
		if(renshi==(n-1))
		{
			printf("%d\n",p);
			sum++;	
		}
	}
	if(sum==0)
	printf("NOT FOUND");
	return 0;
	
}
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();
      
}
//***************************************************
//*  ????1.cpp                                  *
//*  ??????1100012964?                       *
//*  ?????2011?12?                           *
//*  ???????????                         *
//***************************************************
void judge(int *, int *, int);                                
int main()
{
	int i, j, k, n, num[10000] = {0}, num0[10000] = {0};
	cin >> n;
	for (k = 0; ;k++)
	{
		cin >> i >> j;
		if ((i != 0) || (j != 0))
		{
			num0[i] = 1;                             //???????????????????                  
			num[j] = num[j] + 1;                     //?????????
		}
		else 
			break;
	}
	judge(num, num0, n);
	return 0 ;
}
void judge(int * num, int * num0, int n)
{
	int a, b = 0;
	for (a = 0; a < n; a++)
	{
		if ((num[a] == n - 1) && (num0[a] == 0))          //??????????
		{
			cout << a <<endl;
			b++;
		}
	}
	if (b == 0)                                           //?????????????
		cout << "NOT FOUND";
	return ;
}
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;
}
//****************************************************************
//* ? ??4.cpp                                                 *
//* ? ??? ? 1200012916                                      *
//* ? ??2012?12?15?                                        *
//* ? ????????                                          *
//****************************************************************

struct people // ?????
{
	int x;
	int y;
}p;

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

	return 0;
}
main()
{      int n,a[100000],b[100000],i,j,c[100000]={0},k;
       scanf("%d",&n);
       for(i=0;;i++)
      { scanf("%d%d",&a[i],&b[i]); 
      if(a[i]==0&&b[i]==0)
      break;
      }
       k=i-1;   
       for(j=0;j<=(n-1);j++)            
      {for(i=0;i<=k;i++)
      {if(b[i]==j)
       c[j]=c[j]+1;               
                        }
                        }
        i=0;                
       for(j=0;j<=n-1;j++)
      {if(c[j]==n-1)
      {for(i=0;i<=k;i++)
      if(j==a[i])
         break;                
                          }          
       if(i>k)                   
      { printf("%d",j); 
            
        break;
                          }
                          } 
      if(j==n)         
      printf("NOT FOUND");       
                                     
}
main()
{
    int a[10000];
    int b[10000];
    int m,n,i,j,t,p=0;
    scanf("%d",&t);
    for(i=0;i<t;i++)
     {
         a[i]=0;
         b[i]=0;
     }
     for(;;)
      {
          scanf("%d %d",&m,&n);
          if(m==0&&n==0)
          break;
          a[m]=a[m]+1;
          b[n]=b[n]+1;
      }
      for(j=0;j<t;j++)
       {
           if((a[j]==0)&&(b[j]==t-1))
            {
                 p=p+1;
                 printf("%d",j);
            }

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


}
int main()
{
    int n,a,b,c,s = 0,m = 0,t = 0;
    scanf("%d",&n);
    int i[50000],j[50000],k[50000];
    for(a = 0;;a++)
    {
       scanf("%d %d",&i[a],&j[a]);
       s++;
       if (i[a] == 0 && j[a] == 0)
         break;
    }
    for(a = 0;a < n;a++)
         k[a] = 0;
    for(a = 0;a < s-1;a++)
    {
          b = j[a];
          k[b]++;
    }
    for(a = 0;a < n;a++)
    {
          if(k[a] == (n-1))
          {
            c = k[a];
            b = a;
            for(a = 0;a < s-1;a++)
            {
               if(i[a] == b)
               m++;
            }
            if(m == 0)
            {     printf("%d\n",b);
                  t++;
            }
          }
    }
    if (t == 0)
      printf("NOT FOUND\n");
     }
main()
{
      int n,i,t,j,sum,Flag1,Flag2;
      Flag2=0;
      scanf("%d",&n);
      int a[100000];
      if(n==1)
      printf("0");
      else
      {
          for(i=0;;i=i+2)
          { 
             scanf("%d %d",&a[i],&a[i+1]);
             if(a[i]==0&&a[i+1]==0)
                { 
                                 t=i+1;
                                 break;
                                
                }
          }
          //for(i=0;i<=t;i++)
    //  printf("%d",a[i]);
        for(i=0;i<n;i++)
          {
                        Flag1=0;
                        
                      for(j=0;j<=t-2;j=j+2)
                           {   
                                           if(a[j]==i)
                                         //printf("%d %d\n",a[j],i);  
                                         Flag1=1;
                                         
                                         
                                         
                           }
                           //printf("%d",Flag1);
                      if(Flag1==1)
                           continue;
                      sum=0;
                      for(j=1;j<=t-2;j=j+2)
                          {
                                           if(a[j]==i)
                                           sum++;
                          }
                                      if(sum>=n-1)
                          {
                                      printf("%d",i);
                                      Flag2=1;
                                      break;
                          }           
          } 
                          if(Flag2==0)
                          printf("Not Found");          
      
      }      }
main()
{
      int n,i,j,c,a[100000],b[100000],m[10000]={0},p[10000]={0},k=-1;
      scanf("%d",&n);
      for(i=0; ;i++)
      {
               
               scanf("%d %d",&a[i],&b[i]);
               k++;
                if(a[i]==0&&b[i]==0)
                break;
                
      }
      
      for(i=0;i<k;i++)
      {
          m[a[i]]++;
                p[b[i]]++;            
                }      
            
     for(j=0;j<n;j++)
     {
          c=j;           
          if(m[j]==0&&p[j]==(n-1))
         { printf("%d\n",c);
          break;}
          }
    if(j==n)

          printf("NOT FOUND");
          
          
    getchar();getchar();getchar();getchar();
}
int main()
{
	int a[100000], b[100000], i, j, n, k = 0, m = 0, count[10000] = {0};
	cin >> n;
	for(i = 0; ;i++)
	{
		cin >> a[i] >> b[i];
		if(a[i] == 0 && b[i] == 0)
			break;
		m++;
	}
	for(i = 0; i < n; i++)
	{	for(j = 0; j < m; j++)
			if(b[j] == i)
				count[i]++;
	}
	for(i = 0; i < n; i++)
		if(count[i] == n - 1)
		{
			k = 1;
			for(j = 0; j < m; j++)
				if(a[j] == i)
					break;
			if(j == m)
			{
				cout << i << endl;
				break;
			}
			else
			{
				k = 0;
				break;
			}
		}
	if(k == 0)
		cout << "NOT FOUND" << endl;
	return 0;
}
int main()
{
int n,b,i,j,k,l;
int *p;
p=&b;
int c=0;
int flag1=0,flag2,flag3;
scanf("%d",&n);
int a[100000][2];
for(i=0;;i++)
{
scanf("%d %d",&a[i][0],&a[i][1]);
if(a[i][0]==0&&a[i][1]==0)
{*p=i;
break;}
}
for(j=0;j<n;j++)
{
   flag2=0;
   for(l=0;l<b;l++)
   {
      if(j==a[l][0])
      flag2=1;
   } 
   flag3=0;             
   if(flag2==0)
    for(k=0;k<b;k++)
    {
       if(j==a[k][1])
       flag3++;
    }
    if(flag3==n-1)
     {
      c=c+1;
      printf("%d\n",j);
     }
}
if(c==0)
printf("NOT FOUND");    
}
void Qsort(int a[],int low,int up)
{
    int i,j,k,x;
    if (low>=up) return;
    else
    {
        k=a[low];
        j=low;
        for (i=low;i<=up;i++)
        {
            if (a[i]>k)
            {
                j++;
                x=a[i];
                a[i]=a[j];
                a[j]=x;
            }
        }
        x=k;
        a[low]=a[j];
        a[j]=x;
        Qsort(a,low,j-1);
        Qsort(a,j+1,up);
        
    }}
/*int main()
{
    int n,i,j,w,l;
    int a[1000],b[1000];
    scanf("%d",&n);
    while(n!=0){
    for(i=0;i<n;i++)
            a[i]=b[i]=0;
    for (i=0;i<n;i++)
        scanf("%d",&a[i]);
    for (i=0;i<n;i++)
        scanf("%d",&b[i]);
    Qsort(a,0,n-1);
    Qsort(b,0,n-1);
    w=l=0;
        j=0;
    for(i=0;i<n;i++)
    {
        while (a[i]<b[j])j++;
        if (j>=n) {l++;continue;}
        else
        {
            if (a[i]>b[j]) w++;
            j++;
        }
    }
    printf("%d\n",w*200-200*l);
    scanf("%d",&n);
    }
}*/
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");
    }
        
}
int main()
{
    int n,a[100000],b[100000],i=1,j=1,ming;
    scanf("%d",&n);
    for(int k=0;k<n;k++)
    {
            a[k]=0;
            b[k]=0;
    }
    while (i!=0||j!=0)
    {
          scanf("%d %d",&i,&j);
          a[i]=a[i]+1;
          b[j]=b[j]+1;
    }
    for(int k=0;k<n;k++)
    {
            if(b[k]==n-1&&a[k]==0)
            printf("%d\n",k);
            ming=ming+1;
    }
    if(ming==0)
    {
               printf("NOT FOUND");
    }
}
main()
{
	int n;// ??
	scanf("%d",&n);
    int pan[300000]={0},num[300000]={0},s=n*(n-1)/2;
	int a,b,i;
	for(i=1;;i++)
	{
		scanf("%d %d",&a,&b);
		if(a==0&&b==0) break;
		else
		{
			if(pan[a]==0)//??1:????
			{
				pan[a]=1;s=s-a;
			}
			if(pan[b]==0)
				num[b]++;
		}
	}
	if(num[s]==n-1&&pan[s]==0) printf("%d",s);
	else printf("NOT FOUND");
	return 0;
}
/**
 * 1.cpp
 * ?? ??
 * ?? 2011 12 12
 * ?????? ??
 **/
int main()
{
	int n, i, j, a[100000] = {0};
	int *p = a;
	cin >> n;
	
	while (cin >> i && cin >> j && (i != 0 || j != 0))
	{
		(*(p + j))++;
	}
	
	for (i = 0; i < n; i++)
	{
		if (*(p + i) == n - 1)
		{
			cout << i;
			break; 
		}
	}
	if (i == n)
	{
		cout << "NOT FOUND";
	}
	return 0;
}
int pe[2][100000];
int main()
{
    int n;
    cin>>n;
    int a,b;
    for(int i=0;i<n;i++)
    {
    pe[0][i]=0;
    pe[1][i]=0;
    }
    while(true)   
    {
    cin>>a>>b;
    if(a==0&&b==0)
    break;
    pe[0][a]++;
    pe[1][b]++;
    }
    for(int i=0;i<n;i++)
    {
    if(pe[0][i]==0&&pe[1][i]==n-1)
    {
    cout<<i<<endl;
    return 0;
    }
    }
    cout<<"NOT FOUND"<<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 a[100000],b[100000],i=0,l=0,n,j,s,c[100000],d[100000];
    scanf("%d",&n);
    for (;;)
    {
          scanf("%d %d",&a[i],&b[i]);
          if (a[i]==0&&b[i]==0)
           break;
           l++;//l?++???break????break??l??????0????????? 
           i++;//??????i++??i???? 
    }
    for (j=0;j<n;j++)
     {
       c[j]=j;
       d[j]=0;
       for (i=0;i<l;i++)
       {
           if (a[i]==c[j])
            c[j]=-1;
           if (b[i]==c[j])
            d[j]++;
       }
     }
     s=0;
     for (j=0;j<n;j++)
       {
         if (d[j]==(n-1)&&c[j]!=-1)//??d[j]??n-1?????????????????????????? 
         {
           printf ("%d\n",j);
           s++;
         }
       }
     if (s==0)
     printf("NOT FOUND\n");
     getchar();
     getchar();
}
int main()
{
    int n;
    int per[20000][2];
    scanf("%d",&n);
    int k;
    int i,j;
    for(k=0;;k++)
       {
           for(j=0;j<=1;j++)
           {
               scanf("%d",&per[k][j]);
           }
        if(per[k][0]==0&&per[k][1]==0)
        break;
       }
       int sign=0;
       int flag=0;
    for(k=0;k<=n-1;k++)
    {
        for(i=0;;i++)
        {
            if(per[i][0]==0&&per[i][1]==0)
            {
                if(sign==n-1)
                {
                    printf("%d",k);
                    flag++;
                    break;
                }
                if(sign<n-1)
                {
                    printf("NOT FOUND");
                    break;
                }

            }
            else if(k==per[i][1])
               sign++;
            else if(k==per[i][0]&&(per[i][0]!=0||per[i][1]!=0))
               {
                break;
               }
        }
        if(k==n-1&&flag==0)
        printf("NOT FOUND");
        sign=0;
    }
    }
main()
{
      int n;
      scanf("%d",&n);
      int a[100000][2];
      int i,j;
      for(i=0;;i++)
      {
                   scanf("%d %d",&a[i][0],&a[i][1]);
                                   
                   if(a[i][0]==0 && a[i][1]==0) break;
                   }
      int k,l;
      k=i,l=0;
      int c[100000];
      for(i=0;i<n;i++)
      {
                      for(j=0;j<k;j++)
                      {
                                      if(i==a[j][0]) break;
                                      }
                                      if(j==k) {c[l]=i;l++;}
                      }
      int m,p;
      m=0,p=0;
      for(i=0;i<l;i++)
      {
                      for(j=0;j<k;j++)
                      {
                                      if(a[j][1]==c[i]) m++;
                                      }
                                      if(m==n-1) {printf("%d\n",c[i]);p++;}
                      }
                      if(p==0) printf("NOT FOUND\n");
      getchar();getchar();getchar();
      
      }
main()
{
	int num,i,j,k,a[2][100000],m,n;
	scanf("%d",&num);
	for(i=0;i<=num-1;i++)
	{
		a[0][i]=0;
		a[1][i]=0;
	}
	for(;;)
	{
		scanf("%d %d",&m,&n);
		if(m==0&&n==0)
			break;
		else 
		{
			a[0][m]=a[0][m]+1;
			a[1][n]=a[1][n]+1;
		}
	}
	for(i=0;i<=num-1;i++)
	{
		if(a[0][i]==0&&a[1][i]==num-1)
			printf("%d",i);
	}
}
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;
}
int main()
{
   int i=0,j=0,k=-1,m=0,n=0;
   int a[60000];
   int b[60000];
   int sum[60000]={0};
   int num[60000]={0};
   scanf("%d",&n);
   while(1)
   {     
         scanf("%d %d",&a[i],&b[i]);  
        if(a[i]==0&&b[i]==0)
             break;
        else
        {
            for(j=0;j<n;j++)
             {
               if (a[i]==j)
			   {
                          num[j]=-1;
                           break;
			   }
             }
             
            for(j=0;j<n;j++)
            {
                if (b[i]==j) 
				{ 
                                    sum[j]++;
                                     break;
				}
            }
   
        }   
        i++;
   }     
  for(i=0;i<n;i++)
  {
  if(num[i]!=-1)
  {
 if(sum[i]==n-1)
  {
printf("%d",i);
  m=1;
}
  }
  } 
  
  if(m!=1)
  printf("NOT FOUND");   
}
void main()
{
	int n,a[10000]={0},cele,i,j,k,f=0;
	scanf("%d",&n);
	scanf("%d%d",&i,&j);
	while (i!=0 || j!=0)
	{
		a[i]=-1;
		a[j]++;
		scanf("%d%d",&i,&j);
	}
	for (k=0;k<n;k++)
		if (a[k]==n-1) {printf("%d",k);f=1;}
	if (f==0) printf("NOT FOUND");
}
//*******************************************************
//*12.7??  ??????                               *
//*?????  ?? 1100012844                          *
//*???2011?12?10?                                 *
//*******************************************************
int main()
{

	// ???????????????????????
	// ??????????????
	int a[10000][2], n, i, j, k, flag = 1;
	int (*p)[2] = NULL; // ????
	memset(a, 0, sizeof(a)); // ????
	p = a; // ????????
	cin >> n;
	cin >> i >> j;
	while (i != 0 || j != 0) // ????
	{
		*(*(p + i)) += 1; // i????+1
		*(*(p + j) + 1) += 1; // ??j??+1
		cin >> i >> j;
	}
	for (k = 0; k < n; k++) // ??

		// ???????0???n - 1??????????????
		if (*(*(p + k)) == 0 && *(*(p + k) + 1) == n - 1)
		{
			cout << k << endl; // ??
			flag = 0;
		}

	// ??????NOT FOUND
	if (flag)
		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 *man,n;
	scanf ("%d",&n);
	man=(int*)malloc(4*n);

	int i,j,k,sum=0;
	for (i=0;i<=n-1;i++)
		*(man+i)=0;

	for (k=0;;k++)
	{
		scanf ("%d%d",&i,&j);
		if (i==0&&j==0)
			break;
		if (*(man+j)!=-1)
			*(man+j)+=1;
		*(man+i)=-1;
	}
	for (i=0;i<=n-1;i++)
	{
		if (*(man+i)==n-1)
		{
			printf ("%d",i);
			sum=1;
			break;
		}
	}
	if(sum==0)
		printf("NOT FOUND");
	
	
	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);
}