#include <bits/stdc++.h>
using namespace std;
string sol;
const int kBufferSize = 10000;
int BufferInd = kBufferSize;
char Buffer[kBufferSize];
void cit(int &n) {
  ((++BufferInd >= kBufferSize) ? (cin.read(Buffer, kBufferSize), BufferInd = 0)
                                : (0));
  for (; not((((Buffer[BufferInd]) >= '0' and (Buffer[BufferInd]) <= '9') or
              (Buffer[BufferInd]) == '-')
                 ? (1)
                 : (0));
       ((++BufferInd >= kBufferSize)
            ? (cin.read(Buffer, kBufferSize), BufferInd = 0)
            : (0)))
    ;
  bool sign = false;
  if ((Buffer[BufferInd]) == '-') {
    ((++BufferInd >= kBufferSize)
         ? (cin.read(Buffer, kBufferSize), BufferInd = 0)
         : (0));
    sign = true;
  }
  n = 0;
  for (; ((((Buffer[BufferInd]) >= '0' and (Buffer[BufferInd]) <= '9') or
           (Buffer[BufferInd]) == '-')
              ? (1)
              : (0));
       ((++BufferInd >= kBufferSize)
            ? (cin.read(Buffer, kBufferSize), BufferInd = 0)
            : (0))) {
    n *= 10;
    n += (Buffer[BufferInd]) - '0';
  }
  if (sign) n *= -1;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, sum = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      int x;
      cin >> x;
      if (i == j) sum ^= x;
    }
  int q;
  cin >> q;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1 or t == 2) {
      int x;
      cin >> x;
      sum ^= 1;
    } else {
      sol += '0' + sum;
    }
  }
  cout << sol << '\n';
  return 0;
}
