#C13893. Unique Elements Finder

    ID: 43481 Type: Default 1000ms 256MiB

Unique Elements Finder

Unique Elements Finder

Given two lists of integers, your task is to find the elements that are unique to each list. In other words, the output should contain the numbers which appear exactly once in the combined lists.

Let (n) be the number of elements in the first list and (m) be the number of elements in the second list. The two lists are provided in the input, and you should print the unique elements in the order of their first appearance (i.e. if an element occurs in both lists it is omitted).

inputFormat

The input is given via standard input as follows:
- The first line contains an integer (n) denoting the number of elements in the first list.
- The second line contains (n) space-separated integers representing the first list.
- The third line contains an integer (m) denoting the number of elements in the second list.
- The fourth line contains (m) space-separated integers representing the second list.

outputFormat

Output the unique elements (those that occur exactly once across both lists) on a single line separated by a single space. If there are no unique elements, output an empty line.## sample

4
1 2 3 4
4
3 4 5 6
1 2 5 6