View Code of Problem 7

#include<stdio.h>
#include<string.h> 
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n,m;
		scanf("%d",&n);
		int a[100010],i,x,y;
		memset(a,0,100010);
		for(i=0;i<2*n;i++)
		{
			scanf("%d=%d",&x,&y);
			a[x]=y;
			a[y]=x;
		}
		scanf("%d",&m);
		int flag,j,b;
		while(m--)
		{
		  scanf("%d",&b);
		  flag=0;
		  if(a[b]!=0)
		    printf("%d\n",a[b]);
		  else
		   printf("UNKNOW\n");
		}
		printf("\n");
	}
} 

Double click to view unformatted code.


Back to problem 7