#C13720. Symmetric Difference of Two Lists

    ID: 43290 Type: Default 1000ms 256MiB

Symmetric Difference of Two Lists

Symmetric Difference of Two Lists

Given two lists of integers, compute their symmetric difference. The symmetric difference between two sets \(A\) and \(B\) is defined as:

\(A \triangle B = (A \setminus B) \cup (B \setminus A)\)

Your task is to output the integers which are present in one list but not in both. The order of appearance should be preserved: first consider elements from the first list that are not present in the second list, then those from the second list that are not present in the first list. If there are no such elements, output an empty line.

Note: The input is read from stdin and the output should be printed to stdout.

inputFormat

The input consists of 4 lines:

  1. An integer \(n\) representing the number of elements in the first list.
  2. \(n\) space-separated integers. If \(n = 0\), this line may be empty.
  3. An integer \(m\) representing the number of elements in the second list.
  4. \(m\) space-separated integers. If \(m = 0\), this line may be empty.

outputFormat

Print a single line containing the symmetric difference of the two lists as space-separated integers. If there are no elements in the symmetric difference, output an empty line.

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