#include <vector>
#include <iostream>
#include <algorithm>

using std::cin;
using std::cout;
using std::vector;
using std::reverse;
using std::for_each;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for_each(v.begin(),v.end(),[](int &_e){cin >> _e;});
	int q;
	cin >> q;
	while (q--) {
		int b;
		int e;
		cin >> b >> e;
		reverse(v.begin() + b,v.begin() + e);
	}
	int i = 1;
	for_each(v.begin(),v.end(),[&i,n](int _e){cout << _e << (i++ == n ? "\n" : " ");});
}
