#include <iostream>
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
int const N = 1000010;
struct {
char l = '*', r = '*';
char v;
}node[N];
void qxbl(char root)
{
printf("%c", root);
if (node[root].l != '*') qxbl(node[root].l);
if (node[root].r != '*') qxbl(node[root].r);
}
int main()
{
int n;
scanf("%d", &n);
bool j = true;
char root;
while (n--)
{
char str[3];
scanf("%s", str);
if (j)
{
root = str[0];
j = false;
}
node[str[0]].l = str[1];
node[str[0]].r = str[2];
}
qxbl(root);
return 0;
}