// Arup Guha
// 6/13/2024
// Solution to Kattis Problem: Compound Words
// https://open.kattis.com/problems/compoundwords

using namespace std;
#include <bits/stdc++.h>

int main() {

    vector<string> words;
    string s;

    // Read all the words.
    while (cin >> s) words.push_back(s);
    int n = words.size();

    set<string> unique;

    // Try all first words.
    for (int i=0; i<n; i++) {

        // And all second words.
        for (int j=0; j<n; j++) {

            // Tricky, tricky can't put a word with itself.
            if (i == j) continue;

            // Add it!
            unique.insert(words[i]+words[j]);
        }
    }

    // They're sorted because sets are ordered!
    for (string x: unique)
        cout << x << endl;

    return 0;
}
