View Code of Problem 7

#include<stdio.h>
 
int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		int n;
		scanf("%d", &n);
		int temp[10001] = {0};
		for (int i = 0;i < n;i++) {
			int n, m;
			scanf("%d=%d", &n, &m);
			temp[n] = m;
			temp[m] = n;
		}
 
		int m;
		scanf("%d", &m);
		for (int i = 0;i < m;i++) {
			int a;
			scanf("%d", &a);
			if (temp[a] != 0)
				printf("%d\n", temp[a]);
			else
				printf("UNKNOW\n");
			
		}
		printf("\n");
	}
}

Double click to view unformatted code.


Back to problem 7