#include <bits/stdc++.h> using namespace std; bool cmp(string a, string b) { return a.size() < b.size(); } int main() { int n; while (cin >> n) { // 注意 while 处理多个 case cin.ignore(); vector<string> s; string st; while (n--) { getline(cin, st); if (st == "stop")break; s.push_back(st); } sort(s.begin(), s.end(), cmp); for (auto it : s) { cout << it << endl; } } } // 64 位输出请用 printf("%lld")