CodeForces 519B A and B and Compilation Errors

 A and B and Compilation Errors

A and B are preparing themselves for programming contests.

B loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.

Initially, the compiler displayed n compilation errors, each of them is represented as a positive integer. After some effort, B managed to fix some mistake and then another one mistake.

However, despite the fact that B is sure that he corrected the two errors, he can not understand exactly what compilation errors disappeared — the compiler of the language which B uses shows errors in the new order every time! B is sure that unlike many other programming languages, compilation errors for his programming language do not depend on each other, that is, if you correct one error, the set of other error does not change.

Can you help B find out exactly what two errors he corrected?

Input

The first line of the input contains integer n (3 ≤ n ≤ 105) — the initial number of compilation errors.

The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the errors the compiler displayed for the first time.

The third line contains n - 1 space-separated integers b1, b2, ..., bn - 1 — the errors displayed at the second compilation. It is guaranteed that the sequence in the third line contains all numbers of the second string except for exactly one.

The fourth line contains n - 2 space-separated integers с1, с2, ..., сn - 2 — the errors displayed at the third compilation. It is guaranteed that the sequence in the fourth line contains all numbers of the third line except for exactly one.

Output

Print two numbers on a single line: the numbers of the compilation errors that disappeared after B made the first and the second correction, respectively.

Examples

input

5
1 5 8 123 7
123 7 5 1
5 1 7

output

8
123

input

6
1 4 3 3 5 7
3 7 5 4 3
4 3 7 5

output

1
3

Note

In the first test sample B first corrects the error number 8, then the error number 123.

In the second test sample B first corrects the error number 1, then the error number 3. Note that if there are multiple errors with the same number, B can correct only one of them in one step.

翻译:

A和B正在准备即将到来的信息学全国联赛。

B非常喜欢写程序。写完程序以后,他必须先编译代码。最初,编译器显示有Ñ个编译错误,其中每一个被表示为一个正整数。经过一番努力,B设法解决一个错误,然后又编译了下,又改正了一个错误。B可以完全肯定,他纠正了两个错误,但他忘记了是哪几个编译错误消失了。 你能帮助B来找出那两个已经被改正的错误么?

Input

输入的第一行包含整数n(3≤n≤10^ 5) - 表示编译错误的初始数量。

第二行包含n个空格分隔的整数a1,a2,...,an(1≤ai≤10^9),表示第一次编译的时候出现的n个编译错误的序号。

第三行包含n-1个空格分开的整数b1,b2,......,bn-1,表示改正了一个错误以后,第二次编译中显示的错误。保证第三行中的所有数字都是第二行中的所有数字,除了一个被改正了的错误。

第四行有n-2空格分开的整数c1, c2,..., cn-2,表示在又改正了一个错误之后,第三次编译显示的错误。保证在第四行的所有数字都是来自第三行的,除了被改正的那个错误。

Output

输出只有两行,第一行输出一个整数,表示第一次被改正的错误的序号,第二行也输出一个整数,表示第二次被改正的错误的序号。题目保证输入数据都是正确的。

Sample Input

输入样例1:

5

1 5 8 123 7

123 7 5 1

5 1 7

输入样例2:

6

1 4 3 3 5 7

3 7 5 4 3

4 3 7 5

Sample Output

输出样例1:

8

123

输出样例2:

1

3

Hint

注意如果有相同序号的编译错误同时出现,B选手每次最多只能修改一个错误。

本题本来要求使用 C++ STL 来求解的,无意发现(菜鸡的我是由于不会用STL来解(^~~~^))居然不用(@__@)!!!!!!

思路很简单,分别对三次输入进行求和的到ans1,ans2,ans3,输出ans1-ans2和ans2-ans3即可!!!!

#include<stdio.h>

int main(){
	int i,n,m,sum1,sum2,sum3;
	scanf("%d",&n);
	sum1=sum2=sum3=0;
	for(i=0;i<n;i++){
		scanf("%d",&m);
		sum1+=m;
	}
	for(i=0;i<(n-1);i++){
		scanf("%d",&m);
		sum2+=m;
	}
	for(i=0;i<(n-2);i++){
		scanf("%d",&m);
		sum3+=m;
	}
	printf("%d\n%d\n",sum1-sum2,sum2-sum3);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/a_b_c_d_e______/article/details/81153239