#C8659. Unique Elements in an Array

    ID: 52665 Type: Default 1000ms 256MiB

Unique Elements in an Array

Unique Elements in an Array

Given an array of integers, the task is to output the unique elements from the array in the order in which they first appeared.

When an element appears for the first time, it is printed; subsequent occurrences are ignored. The condition can be formulated as: $$unique_i = a_i, \quad \text{if } a_i \notin \{a_0, a_1, \dots, a_{i-1}\}.$$

This problem tests your ability to process input and retain order while filtering out duplicates.

inputFormat

The first line contains an integer \(n\), the number of elements in the array. The second line contains \(n\) integers separated by spaces.

outputFormat

Output the unique elements from the array in their original order, separated by spaces.

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

</p>