#include <iostream>
// write your code here......
#include<vector>
using namespace std;

int main() {

    // write your code here......
    vector<int> v;
    
    for(int i=0;i<5;i++)
    {
        int temp=0;
        cin>>temp;
        v.push_back(temp);
        
    }
    //正向迭代器
    for(vector<int>::iterator it=v.begin();it!=v.end();it++)
    {
        cout<<*it<<" ";
    }
    cout<<endl;
    //反向迭代器
    for(vector<int>::reverse_iterator revit=v.rbegin();revit!=v.rend();revit++)
    {
        cout<<*revit<<" ";
    }

    return 0;
}