Math Homework

Time limit1sMemory limit128 MB

Problem

Sanggeun must find the numbers written inside several lines of text and arrange them in nondecreasing order.

Each line contains only lowercase English letters and digits. A number is the longest consecutive run of adjacent digits. Therefore, immediately before and after such a run there must be either the boundary of the line or a letter.

Leading zeros are removed when comparing and printing numbers. If every digit in a number is zero, print it as 0.

For instance, the string 01a2b3456cde478 contains the numbers 1, 2, 3456, and 478.

Write a program that finds all numbers in the given lines and prints them in nondecreasing order.

Input

The first line contains the number of lines N on the paper. (1 ≤ N ≤ 100)

Each of the next N lines contains one line from the paper. Each line has length at most 100 and consists only of lowercase English letters and digits.

Output

Let M be the number of numbers found on the paper. Print M lines, one number per line.

Print the numbers in nondecreasing order. Remove leading zeros before printing, and print an all-zero number as 0.