#include <bits/stdc++.h>

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int q; cin >> q;
    while (q--) {
        int l, r; cin >> l >> r;
        reverse(v.begin() + l, v.begin() + r);
    }
    rep(i, n) {
        cout << v[i] << " \n"[i==n-1];
    }
}
