The input of the program is a sequence of N natural numbers, each of which is not greater than 10000. It is required to output the digits occurring in these numbers in non-decreasing order of their frequency of occurrence. If some digits occur the same number of times, they are displayed in descending order.
Input
The input to the program is a natural number N (\(N <= 10000\)), and then N< /code> natural numbers, each of which does not exceed 10000.
Imprint
Output the digits that occur in these numbers, in non-decreasing order of their frequency of occurrence.
Examples
| # |
Input |
Output |
| 1 |
3
456
20
3452
|
6 3 0 5 4 2 |