#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int i;
    vector<int> A;
    int n;
    cin >> n;
    for (i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        A.push_back(a);
    }
    int q;
    cin >> q;
    for (i = 0; i < q; i++)
    {
        int b, e;
        cin >> b >> e;
        reverse(A.begin() + b, A.begin() + e);
    }
    for (i = 0; i < A.size() - 1; i++)
    {
        cout << *(A.begin() + i) << ' ';
    }
    cout << A.back() << endl;
}
