#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[1010];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int x, y;
		cin >> x >> y;
		reverse(a + x, a + y);
	}
	rep(i, n)cout << a[i] << (i == n - 1 ? "\n" : " ");
	return 0;
}
