#include <bits/stdc++.h>
using namespace std;
const int N=100;
int n;
struct node {
char r,l;
}tree[N];
char root1,root;
void print(char x){
if(x=='*')return ;
cout<<x;
print(tree[x].l);
print(tree[x].r);
}
int main(){
cin>>n;
string s1;
cin>>s1;
root1=s1[0];
root=s1[0];
tree[root].l=s1[1];
tree[root].r=s1[2];
for(int i=2;i<=n;i++){
string s;
cin>>s;
tree[s[0]].l=s[1];
tree[s[0].r=s[2];
}
print(root);
}