import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class P1181 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
List<String> list = new ArrayList<String>();
for (int i = 0; i < n; i++) {
String str = sc.next();
list.add(str);
}
Collections.sort(list);
Collections.sort(list, (s1, s2) -> {
if (s1.length() > s2.length()) {
return 1;
} else if (s1.length() < s2.length()) {
return -1;
}
return 0;
});
String temp = " ", str;
for (int i = 0; i < n; i++) {
str = list.get(i);
if (!temp.equals(str)) {
System.out.println(str);
}
temp = str;
}
sc.close();
}
}