#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double E = exp(1);
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int mat[1005][1006];
vector<int> res;
int main() {
  int n;
  int sum;
  int type;
  while (scanf("%d", &n) == 1) {
    sum = 0;
    res.clear();
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        scanf("%d", &mat[i][j]);
        if (i == j) {
          sum += (mat[i][j]);
          sum &= 1;
        }
      }
    int q;
    scanf("%d", &q);
    for (int k = 0; k < q; ++k) {
      scanf("%d", &type);
      if (type == 3) {
        res.push_back(sum);
      } else {
        scanf("%d", &type);
        sum += 1;
        sum &= 1;
      }
    }
    for (int i = 0; i < (int)res.size(); ++i) printf("%d", res[i]);
    printf("\n");
  }
  return 0;
}
