#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <climits>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

vector<string> split(string haystack, string needle) {
    vector<string> result;
    int startPos = 0;
    int foundPos = haystack.find(needle, startPos);
    while (foundPos != string::npos) {
        int count = foundPos - startPos;
        string token = haystack.substr(startPos, count);
        if (!token.empty()) {
            result.push_back(token);
        }
        startPos = foundPos + needle.length();
        foundPos = haystack.find(needle, startPos);
    }
    string token = haystack.substr(startPos, haystack.length() - startPos);
    if (!token.empty()) {
        result.push_back(token);
    }
    return result;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;getline(cin, s);
    
    vector<string> parts = split(s, " ");
    set<string> word{ parts.begin(),parts.end() };

    for (auto value : word) {
        cout << value << " ";
    }

    set<string> seens;
    for (string word : parts) {
        if (seens.find(word) == seens.end()) {
            cout << word << " ";
            seens.insert(word);
        }
    }
    return 0;
}

