#C6686. Unique Numbers Extraction in Sequences

    ID: 50473 Type: Default 1000ms 256MiB

Unique Numbers Extraction in Sequences

Unique Numbers Extraction in Sequences

You are given an integer \(n\) followed by \(n\) lines, each containing a sequence of space-separated integers. Your task is to extract all unique numbers from these sequences, preserving the order of their first occurrence. Print the unique numbers separated by a single space.

Example:

Input:
3
1 2 2 3 4
3 5 6 3 7
8 9 5 1

Output: 1 2 3 4 5 6 7 8 9

</p>

Note: Even if a number appears multiple times in one or across several sequences, only its first occurrence is considered.

inputFormat

The first line of the input contains an integer \(n\) (\(1 \leq n \leq 1000\)), indicating the number of sequences. Each of the next \(n\) lines contains a sequence of space-separated integers. Each sequence may include duplicate numbers, and some sequences may be empty.

outputFormat

Output a single line containing the unique numbers extracted from all sequences, in the order of their first occurrence, separated by a single space.

## sample
3
1 2 2 3 4
3 5 6 3 7
8 9 5 1
1 2 3 4 5 6 7 8 9