#include<iostream>
using namespace std;
typedef struct node
{
char data;
struct node *lchild,*rchild;
}Node,* tree;
int count;
void Insert(tree &bt)
{
if(count==0) return;
char ch;
cin>>ch;
if(ch!='*')
{
bt=new node;
bt->data=ch;
bt->lchild=bt->rchild=NULL;
Insert(bt->lchild);
Insert(bt->rchild);
}
else
bt=NULL;
count--;
}
void print(tree bt)
{
if(bt)
{
cout<<bt->data;
if(bt->lchild) print(bt->lchild);
if(bt->rchild) print(bt->rchild);
}
}
int main()
{
cin>>count;
tree My_bt;
Insert(My_bt);
print(My_bt);
return 0;
}