#include<iostream>
using namespace std;
int main()
{
	int N, M, i;
	cin >> N;
	int a[N], x, t;
	for (i = 0; i < N; i++) 
		cin >> a[i];

	cin >> M;
	int temp;
	while (M--)
	{
		
		cin >> x >> t;
		while (x < t-1)
		{
			temp = a[x];
			a[x] = a[t-1];
			a[t-1] = temp;
			x++;
			t--;
		}
	}

	for (i = 0; i < N; i++)
	{
		if(i) cout << " ";
		cout << a[i];
	}
	cout << endl;
	return 0;
}
