Problem F
Early Orders

You are given a list of integers
Find the lexicographically smallest subsequence of
Input
The first line contains two integers
Output
Write out on one line, separated by spaces, the
lexicographically smallest subsequence of
Sample Input 1 | Sample Output 1 |
---|---|
6 3 3 2 1 3 1 3 |
2 1 3 |
Sample Input 2 | Sample Output 2 |
---|---|
10 5 5 4 3 2 1 4 1 1 5 5 |
3 2 1 4 5 |