#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EXP1 = exp(1);
template <typename T>
inline T sqr(T n) {
  return n * n;
}
inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }
template <typename T>
inline T pmod(T n, T m) {
  return ((n % m) + m) % m;
}
template <typename T>
T power(T n, int p) {
  return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template <typename T>
T bigmod(T n, int p, T m) {
  return (p == 0)
             ? (T)(1)
             : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %
                   m;
}
int test, cas = 1;
char mat[1010][1010];
int main() {
  int n, q;
  int x, y;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) {
      scanf("%d", &x);
      mat[i][j] = x;
    }
  char square = 0;
  for (int i = 0; i < n; ++i) square ^= mat[i][i];
  scanf("%d", &q);
  string res;
  while (q--) {
    scanf("%d", &x);
    if (x == 3) {
      res.push_back(square + '0');
    } else {
      scanf("%d", &y);
      square = 1 - square;
    }
  }
  cout << res << endl;
  return 0;
}
