#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define INF 1000000007

int main(void){
  vector<int> v;
  int n,q,b,e;
  
  cin >> n;
  for (int i=0; i<n; i++){
    int t; cin >> t;
    v.push_back(t);
  }
  cin >> q;
  for (int i=0; i<q; i++){
    cin >> b >> e;
    reverse(v.begin()+b, v.begin()+e);
  }
  cout << v[0];
  for (int i=1; i<v.size(); i++){
    cout << " " << v[i];
  } cout << endl;
  return 0;
}
  
  

