#include <iostream>
#include <vector>
#include <regex>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> tail; // Using the word "tail" as the name of the list

    string name;
    regex validName("^[a-zA-Z0-9]+$"); // Alphanumeric only

    for (int i = 0; i < n; ++i) {
        cin >> name;
        if (!regex_match(name, validName)) {
            cout << "Invalid input" << endl;
            return 0;
        }
        tail.push_back(name); // Add to the tail
    }

    for (int i = 0; i < tail.size(); ++i) {
        cout << tail[i];
        if (i != tail.size() - 1) cout << " ";
    }
    cout << endl;

    return 0;
}