Remove duplicates, keep the order

Print the elements of the array without duplicates, keeping each value where it first appeared.

Reported in: TCS NQT (9 May 2024) (memory-based)

Input

First line: N. Second line: N integers.

Output

The unique values in order of first appearance.

Constraints

1 ≤ N ≤ 10^5.

Example 1

Input:
7
1 3 2 1 4 3 5

Output:
1 3 2 4 5

Example 2

Input:
4
9 9 9 9

Output:
9

Hint: Keep a set of values already printed; print a value only the first time you meet it.

All coding practice