import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = Integer.valueOf(sc.nextLine()); int[] v = new int[N]; for(int i = 0; i < N; ++i) { String s = sc.nextLine(); v[i] = Integer.valueOf(s.substring(s.length() - 6)); } Arrays.sort(v); for(int i = 0; i < N; ++i) System.out.println(v[i]); } }