#include <cstdio>
int v[30], s, son[30][2];
bool vis[30];
void preorder(int u)
{
if (u == '*' - 'a' + 1)
return;
v[s++] = u + 'a' - 1;
preorder(son[u][0]);
preorder(son[u][1]);
}
int main()
{
char a, b, c;
int n, root;
scanf("%d\n", &n);
for (int i = 0; i < n; i++)
{
a = getchar(), b = getchar(), c = getchar();
getchar();
son[a - 'a' + 1][0] = b - 'a' + 1;
son[a - 'a' + 1][1] = c - 'a' + 1;
vis[b - 'a' + 1] = 1;
vis[c - 'a' + 1] = 1;
}
for (int i = 1; i <= 26; i++)
if (vis[i] == 0)
{
root = i;
break;
}
preorder(root);
for (int i = 0; i < s; i++)
putchar(v[i]);
return 0;
}