public static void main(String... args) throws IOException {
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();
        int unsqr = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                int v = sc.nextInt();
                if (j == i) {
                    unsqr ^= v;
                }
            }
        }

        StringBuilder sb = new StringBuilder();

        int q = sc.nextInt();

        for (int i = 0; i < q; i++) {
            int com = sc.nextInt();
            switch (com) {
                case 1:
                case 2:
                    sc.nextInt();
                    unsqr = 1 - unsqr;
                    break;
                case 3:
                    sb.append(unsqr);
                    break;
            }
        }
        System.out.println(sb.toString());
    }