#include <iostream>

#include <cstring>

#include <algorithm>


using namespace std;


int main(void) {

int t;

int n = 0;

int c = 0;

cin >> t;

string temp;

string str[t] = {};

for(int i = 0; i < t; i++) {

cin >> str[i];

}

stable_sort(str, str + t);

for(int i = 0; i < t; i++) {

for(int j = i+1; j < t; j++) {

if(str[i].size() > str[j].size()) {

temp = str[i];

str[i] = str[j];

str[j] = temp;

}

}

}

for(int i = 0; i < t; i++) {

if(str[i] != str[i + 1]) {

c++;

}

}

string num[t] = {};

for(int i = 0; i < t; i++) {

if(str[i] != str[i + 1]) {

num[n] = str[i];

            n++;

}

}

for(int i = 0; i < c; i++) {

cout << num[i] << endl;

}

return 0;

}





백준 예제 다 맞고

길이 짧은 거 부터, 길이 같으면 사전 순으로 다 맞는데 왜 9퍼에서 안되는거야 제발 3시간째 짱구 굴리는데 답이 안나와