#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-9;
const int INF = 2e9;
const long long LINF = 1e18;
template <class T>
const T sqr(const T &x) {
  return x * x;
}
template <class T>
const T &min(const T &a, const T &b, const T &c) {
  return min(min(a, b), c);
}
template <class T>
const T &max(const T &a, const T &b, const T &c) {
  return max(max(a, b), c);
}
struct DbgStream {
  template <class T>
  DbgStream &operator<<(const T &x) {
    return *this;
  }
} z_dbg;
int n, ans, q;
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      int x;
      scanf("%d", &x);
      if (i == j) ans ^= x;
    }
  }
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 3) {
      putchar('0' + ans);
    } else {
      scanf("%d", &t);
      ans ^= 1;
    }
  }
  putchar('\n');
  return 0;
}
