프로그램 명: coci_sorting
제한시간: 1 초

Mirko is a great code breaker. He knows any cipher in the world can be broken by frequency analysis. He has completely the wrong idea what frequency analysis is, however.

He intercepted an enemy message. The message consists of N numbers, smaller than or equal to C Mirko belives freqency analysis consists of sorting this sequence so that more frequent numbers appear before less frequent ones.

Formally, the sequence must be sorted so that given any two numbers X and Y , X appears before Y if the number of times X appears in the original sequence is larger than the number of time Y does. If the number of appearances is equal, the number whoes value appears sooner in the input should appear sooner in the sorted sequence.

Help Mirko by creating a "frequency sorter".

입력

출력

First and only line of output should contain N numbers, the sorted sequence.

입출력 예

input

5 2
2 1 2 1 2

output

2 2 2 1 1

input

9 3
1 3 3 3 2 2 2 1 1

output

1 1 1 3 3 3 2 2 2

input

9 77
11 33 11 77 54 11 25 25 33

output

11 11 11 33 33 25 25 77 54
출처: COCI 2009/2010 contest3 3/6

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]