#include<iostream>
#include<queue>
#include<string>
using namespace std;
struct str{
string s;
int len;
str(string str,int l):s(str),len(l){}
bool operator<(const str& st)const{
if(len==st.len)
return s>st.s;
return len>st.len;
}
};
int main(){
int n;
while(cin>>n){
string s;
priority_queue<str> pq;
while(n--){
cin>>s;
pq.push(str(s,s.size()));
}
while(pq.size()){
cout<<pq.top().s<<endl;
pq.pop();
}
}
return 0;
}



京公网安备 11010502036488号