#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef int i64;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 mod = 998'244'353ll;

const i64 inf = 1'000'000'000'000'000'000ll;

const long double eps = 1e-8;

struct TCalcSegTree {
    using Type = i64;
    const Type Zero = 0;

    inline Type Combine(Type a, Type b) {
        return a ^ b;
    }

    i64 N = 0;
    vector<Type> St;

    TCalcSegTree() {}

    TCalcSegTree(i64 size) {
        Init(size);
    }

    void Init(i64 size) {
        N = 1;
        while (N < size) {
            N *= 2;
        }
        St.assign(N * 2, Zero);
    }

    void Set(i64 i, Type v, i64 x, i64 lx, i64 rx) {
        if (rx - lx == 1) {
            St[x] = Combine(St[x], v);
            return;
        }

        i64 m = (lx + rx) / 2;
        if (i < m) {
            Set(i, v, x * 2 + 1, lx, m);
        }
        else {
            Set(i, v, x * 2 + 2, m, rx);
        }

        St[x] = Combine(St[x * 2 + 1], St[x * 2 + 2]);
    }

    void Set(i64 i, Type v) {
        Set(i, v, 0, 0, N);
    }

    Type Calc(i64 l, i64 r, i64 x, i64 lx, i64 rx) {
        if (lx >= r || l >= rx) {
            return Zero;
        }

        if (l <= lx && rx <= r) {
            return St[x];
        }

        i64 m = (lx + rx) / 2;
        Type v1 = Calc(l, r, x * 2 + 1, lx, m);
        Type v2 = Calc(l, r, x * 2 + 2, m, rx);
        return Combine(v1, v2);
    }

    Type Calc(i64 l, i64 r) {
        return Calc(l, r, 0, 0, N);
    }
};


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    if (sizeof(i64) != sizeof(long long int)) {
        cerr << "i64 != long long int" << endl;
    }

    i64 n, m;
    cin >> n >> m;

    vector<i64> a(n);
    for (i64 i = 0; i < n; i++) {
        cin >> a[i];
    }

    TCalcSegTree st(n);
    for (i64 i = 0; i < n; i++) {
        st.Set(i, a[i]);
    }

    stringstream ss;

    for (i64 i = 0; i < m; i++) {
        i64 t, x, y;
        cin >> t >> x >> y;
        if (t == 1) {
            st.Set(x - 1, y);
        }
        else {
            i64 R = st.Calc(x - 1, y);
            ss << R << endl;
        }
    }
    cout << ss.str();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define rrep(i, a, b) for (ll i = b - 1; a <= i; i--)
ll MOD = 1000000007;

ll N, M, Q, X[200010], Y[200010], op[200010][2], A[200010], B[200010];
ll c[200010][2], sign[200010][2];
bool swap_xy[200010];

int main () {
  cin >> N;
  rep (i, 0, N) cin >> X[i] >> Y[i];
  cin >> M;
  rep (i, 0, M) {
    cin >> op[i][0];
    if (op[i][0] > 2) cin >> op[i][1];
  }
  cin >> Q;
  rep (i, 0, Q) {
    cin >> A[i] >> B[i];
    B[i]--;
  }

  sign[0][0] = sign[0][1] = 1;

  rep (i, 0, M) {
    ll p = op[i][1];
    if (op[i][0] == 1) {
      c[i+1][0] = c[i][1];
      c[i+1][1] = -c[i][0];
      sign[i+1][0] = sign[i][1];
      sign[i+1][1] = -sign[i][0];
      swap_xy[i+1] = !swap_xy[i];
    } else if (op[i][0] == 2) {
      c[i+1][0] = -c[i][1];
      c[i+1][1] = c[i][0];
      sign[i+1][0] = -sign[i][1];
      sign[i+1][1] = sign[i][0];
      swap_xy[i+1] = !swap_xy[i];
    } else if (op[i][0] == 3) {
      c[i+1][0] = 2 * p - c[i][0];
      c[i+1][1] = c[i][1];
      sign[i+1][0] = -sign[i][0];
      sign[i+1][1] = sign[i][1];
      swap_xy[i+1] = swap_xy[i];
    } else {
      c[i+1][0] = c[i][0];
      c[i+1][1] = 2 * p - c[i][1];
      sign[i+1][0] = sign[i][0];
      sign[i+1][1] = -sign[i][1];
      swap_xy[i+1] = swap_xy[i];
    }
  }

  rep (i, 0, Q) {
    ll x = X[B[i]], y = Y[B[i]];
    if (swap_xy[A[i]]) swap(x, y);

    x = c[A[i]][0] + sign[A[i]][0] * x;
    y = c[A[i]][1] + sign[A[i]][1] * y;
    cout << x << " " << y << endl;
  }
}
