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



int main() {
    vector<int>v;
    int a;
    while(cin>>a)
    v.push_back(a);
    for(auto iter = v.begin();iter != v.end();iter++)
    {
        cout<<*iter<<" ";
    }
    cout<<endl;
    for(auto iter = v.end()-1;iter != v.begin()-1;iter--)
    {  
        cout<<*iter<<" ";
    }
    cout<<endl;
 

    // write your code here......
    

    return 0;
}