#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const int SZ = 26 + 7;
int main(int argc, const char **argv) {
  long long test, RES, Q, POS;
  while (scanf("%I64d", &test) == 1) {
    RES = 0;
    POS = 1;
    for (int i = 1; i <= (test * test); ++i) {
      scanf("%I64d", &Q);
      if (i == POS) {
        RES += Q;
        POS += (test + 1);
      }
    }
    RES %= 2;
    scanf("%I64d", &Q);
    for (int i = 1; i <= Q; ++i) {
      scanf("%I64d", &test);
      if (test == 1 or test == 2) {
        scanf("%I64d", &POS);
        RES++;
        RES %= 2;
      } else
        printf("%I64d", RES);
    }
    printf("\n");
  }
  return 0;
}
