problem
solution
codes
#include<iostream>
#include<string>
#define maxn 550
using namespace std;
int tree[maxn][2];
void dfs(char x){
cout<<x;
if(tree[x][0] != (int)'*')dfs(tree[x][0]);
if(tree[x][1] != (int)'*')dfs(tree[x][1]);
}
int main(){
int n,root; cin>>n;
for(int i = 1; i <= n; i++){
string s; cin>>s;
tree[s[0]][0] = s[1];
tree[s[0]][1] = s[2];
if(i==1)root = s[0];
}
dfs(root);
return 0;
}