import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 1;i<n+1;i++){ String s = sc.next(); int number = Integer.parseInt(s.substring(s.length()-6,s.length())); int j = i-1; for(;j>0&&arr[j-1]>number;j--){ arr[j]= arr[j-1]; } arr[j] = number; } for(int i:arr){ System.out.println(i); } } }