#C6453. Find the Missing Element

    ID: 50215 Type: Default 1000ms 256MiB

Find the Missing Element

Find the Missing Element

You are given two lists for each test case. The first list contains N-1 integers while the second (original) list contains N integers. One element from the original list is missing in the first list. Your task is to determine this missing element.

Mathematically, if the original list is \(a_1, a_2, \ldots, a_N\) and the first list is \(b_1, b_2, \ldots, b_{N-1}\), then the missing element is given by:

\(missing = \sum_{i=1}^{N} a_i - \sum_{j=1}^{N-1} b_j\)

Note that the lists may contain duplicate elements.

inputFormat

The first line of the input contains a single integer \(T\), the number of test cases. Each test case consists of three lines:

  • The first line contains an integer \(N\), the number of elements in the original list.
  • The second line contains \(N-1\) space-separated integers representing the first list.
  • The third line contains \(N\) space-separated integers representing the original list.

outputFormat

For each test case, print the missing element on a new line.

## sample
5
1 2 3 4
1 2 3 4 5
5