#include "bits/stdc++.h"

using namespace std;

constexpr int INF = numeric_limits<int>::max() / 2;

class Dinic
{
    using type = int;
    const int INF = 1e9;
    struct Edge
    {
        // 行き先, 容量, 逆辺
        int to;
        type cap;
        int rev;
        Edge(int _t, type _c, int _r) : to(_t), cap(_c), rev(_r) {}
    };

    using Graph = std::vector<std::vector<Edge>>;
    int V;
    Graph G;
    // s からの最短距離
    std::vector<int> level;
    // 訪問済みか
    std::vector<int> iter;

    void bfs(int s)
    {
        fill(level.begin(), level.end(), -1);
        std::queue<int> que;
        level[s] = 0;
        que.push(s);
        while (!que.empty())
        {
            int v = que.front();
            que.pop();
            for (const auto &e : G[v])
            {
                if (e.cap > 0 && level[e.to] < 0)
                {
                    level[e.to] = level[v] + 1;
                    que.push(e.to);
                }
            }
        }
    }
    // 増加パスを探す
    type dfs(int v, int t, type f)
    {
        if (v == t)
            return f;
        for (int &i = iter[v]; i < (int)G[v].size(); i++)
        {
            Edge &e = G[v][i];
            if (e.cap > 0 && level[v] < level[e.to])
            {
                type d = dfs(e.to, t, std::min(f, e.cap));
                if (d > 0)
                {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

public:
    Dinic(int _v) : V(_v), G(_v), level(_v), iter(_v) {}
    void add(int from, int to, type cap)
    {
        G[from].push_back(Edge{to, cap, (int)G[to].size()});
        G[to].push_back(Edge{from, 0, (int)G[from].size() - 1});
    }
    type maxFlow(int s, int t)
    {
        type ret = 0;
        while (true)
        {
            bfs(s);
            if (level[t] < 0)
                return ret;
            fill(iter.begin(), iter.end(), 0);
            type f;
            while ((f = dfs(s, t, INF)) > 0)
            {
                ret += f;
            }
        }
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<int>> cnt(26, vector<int>(26, 0));
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        int len = s.size();
        cnt[s[0] - 'a'][s[len - 1] - 'a']++;
    }
    for (char c = 0 /* a */; c < 26 /* z */; c++)
    {
        int sz = 26 * 26;
        int src = 0, dest = sz * 2 + 1;
        Dinic g(2 * sz + 2);
        int sum = 0, sum2 = 0;
        for (int i = 0; i < 26; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                // i/j
                int st = 26 * i + j + 1, gt = st + sz;
                g.add(st, gt, cnt[i][j]);
                if (i == c)
                {
                    g.add(src, st, INF);
                    sum += cnt[i][j];
                }
                if (j == c)
                {
                    g.add(gt, dest, INF);
                    sum2 += cnt[i][j];
                }
                for (int k = 0; k < 26; k++)
                {
                    // j/k
                    int st2 = 26 * j + k + 1;
                    g.add(gt, st2, INF);
                }
            }
        }
        int f = g.maxFlow(src, dest);
        if (sum2 && f >= sum)
            cout << (char)('a' + c) << endl;
    }
}


Measured memory_bytes: 3696