#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

bool lessNum (string const & a, string const & b) {
    if (a.size () != b.size ())
        return a.size () < b.size ();
    return a < b;
}

int main () {
    vector <string> s;
    string t;
    while (cin >> t)
        s.push_back (t);
    sort (s.begin (), s.end (), lessNum);
    for (auto e : s)
        cout << e << endl;
    return 0;
}
