#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N;
	scanf("%d",&N);

	int tmp;
	vector<int> V;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&tmp);
		V.push_back(tmp);
	}

	int num_query;
	scanf("%d",&num_query);

	int left,right;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d %d",&left,&right);
		reverse(V.begin()+left,V.begin()+right);
	}

	printf("%d",V[0]);
	for(int i = 1; i < V.size(); i++){
		printf(" %d",V[i]);
	}
	printf("\n");

	return 0;
}


