#include <bits/stdc++.h>
using namespace std;
template <class T>
void checkMin(T& r, T v) {
  if (r > v) r = v;
}
template <class T>
void checkMax(T& r, T v) {
  if (r < v) r = v;
}
const int N = 1010;
int mp[N][N];
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) scanf("%d", mp[i] + j);
    int ans = 0;
    for (int i = 0; i < n; ++i) ans += mp[i][i];
    ans %= 2;
    int q;
    scanf("%d", &q);
    while (q--) {
      int type, index;
      scanf("%d", &type);
      if (type < 3) {
        scanf("%d", &index);
        ans ^= 1;
      } else
        putchar('0' + ans);
    }
    puts("");
  }
  return 0;
}
