#P4305. Remove Duplicates from Sequence

    ID: 17551 Type: Default 1000ms 256MiB

Remove Duplicates from Sequence

Remove Duplicates from Sequence

Given \( n \) numbers, remove the duplicates so that only the first occurrence of each number is retained.

You are required to output the unique numbers in the order they first appear in the input.

For example, if the input is "1 2 3 2 1", the output should be "1 2 3".

inputFormat

The first line contains an integer \( n \) representing the number of elements.

The second line contains \( n \) space-separated integers.

outputFormat

Output the unique numbers in the order of their first occurrences, separated by a single space.

sample

5
1 2 3 2 1
1 2 3