Problem Description

Read n integers. Sort them by frequency ascending, if tie by value ascending. Output sorted list.

Input Format

First line n. Second line n integers.

Output Format

One line sorted list.

Sample Test Case

Input:
7 4 5 6 5 4 3 3
Output:
6 4 4 5 5 3 3

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next