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

int main() {

    // write your code here......
    vector<int> v;
    int in = 0;

    for (int i = 0; i < 5; i++) {
        // cin >> v[i];
        cin >> in;
        v.push_back(in);
    }
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
        cout << *it << " ";
    }
    cout << endl;

    int vsize = v.size();
    vector<int>::iterator it = v.begin() + vsize - 1;
    for (int i = 0; i < vsize; i++) {
        cout << *it << " ";
        it--;
    }
    cout << endl;

    return 0;
}