#include<bits/stdc++.h>
using namespace std;
struct node
{
    int date;
    node *next;
    node()
    {
        date=0;
        next=NULL;
    }
};
node head;
void build_list()
{
    cout<<"ÇëÊäÈëÁ´±í³¤¶È"<<endl;
    int n; cin>>n;
    node *p=&head;
    for(int i=1;i<=n;i++)
    {
        if(p->next==NULL)
        {
            p->next=new node;
        }
        p=p->next;
        cin>>p->date;
        p->next=NULL;
    }
}
node *f=&head;
void DFS(node *p)
{
    if(p->next==NULL)
    {
        f->next=p;
        f=f->next;
        f->next=NULL;
        return ;
    }
    node *q=p;
    DFS(p->next);
    f->next=q;
    f=f->next; //cout<<"----////"<<f->date<<endl;
    f->next=NULL;

}
void destroy()
{

}
int main()
{
    build_list();
    node *p=&head;
    while(p->next!=NULL)
    {
        cout<<"===";
        p=p->next;
        cout<<p->date<<endl;
    }
    cout<<"-------------------------"<<endl;
    p=&head;
    p=p->next;
    DFS(p);
    p=&head;
    int i=1;
    while(p->next!=NULL)
    {
        i++; if(i==10) break;
        cout<<"===";
        p=p->next;
        cout<<p->date<<endl;
    }
}