#include <bits/stdc++.h>
struct Graph
{
    Graph(const std::size_t v) : V{v}, edge(v), rev_edge(v) {}
    void addEdge(const std::size_t from, const std::size_t to) { edge[from].push_back(to), rev_edge[to].push_back(from); }
    const std::size_t V;
    std::vector<std::vector<std::size_t>> edge, rev_edge;
};
int main()
{
    int n;
    std::cin >> n;
    constexpr int N = 26;
    Graph g(N);
    std::vector<int> in(N, 0), out(N, 0);
    for (int i = 0; i < n; i++) {
        std::string s;
        std::cin >> s;
        const int S = s.front() - 'a', T = s.back() - 'a';
        g.addEdge(S, T);
        in[T]++, out[S]++;
    }
    std::vector<bool> ok(N, false);
    std::vector<bool> checked(N, false);
    std::queue<int> q;
    for (int i = 0; i < N; i++) {
        if (in[i] > 0 and out[i] == 0) { checked[i] = ok[i] = true, q.push(i); }
    }
    while (not q.empty()) {
        const int i = q.front();
        checked[i] = true;
        q.pop();
        for (const int to : g.rev_edge[i]) {
            if (out[to] == 1) { q.push(to); }
        }
    }

    for (int i = 0; i < N; i++) {
        if (checked[i]) {
            if (ok[i]) { std::cout << (char)(i + 'a') << std::endl; }
        } else {
            if (in[i] > 0 and out[i] <= in[i]) { std::cout << (char)(i + 'a') << std::endl; }
        }
    }
    return 0;
}

