#include <bits/stdc++.h>
using namespace std;
const int stx[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 0, 2, 1, 0, 1, 3, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 2, 0, 3, 1,
        2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 3, 1, 2, 0, 2, 3, 1, 2, 0, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
        0, 3, 1, 2, 2, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 2, 1, 3, 0, 2, 2, 1, 3, 0, 2, 2, 1, 3,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 2, 3, 1, 0, 2, 1,
        3, 2, 1, 0, 2, 1, 3, 2, 1, 0, 2, 1, 3, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 2, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 0, 2, 1, 0, 1, 3, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 3, 0, 3, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 3, 0, 0, 3, 1, 1, 3, 0, 0, 3, 1, 1, 3, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 2, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 3, 2,
        0, 2, 1, 3, 2, 0, 2, 1, 3, 2, 0, 2, 1, 3, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 2, 0, 0, 3, 1, 1, 2, 0, 0, 3, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2,
        3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 2, 2, 0, 0, 3, 1, 1, 2, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 2, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 2, 0, 3, 1,
        2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 3, 1, 2, 0, 2, 3, 1, 2, 0, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 3, 0, 3, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 3, 0, 0, 3, 1, 1, 3, 0, 0, 3, 1, 1, 3, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 3, 0, 1, 2, 1, 2, 0, 1, 0,
        1, 2, 3, 2, 0, 1, 0, 1, 2, 3, 2, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 3, 1, 1, 1, 3,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 3, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 3, 1, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
        0, 3, 1, 2, 2, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 2, 1, 3, 0, 2, 2, 1, 3, 0, 2, 2, 1, 3,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 3, 2,
        0, 2, 1, 3, 2, 0, 2, 1, 3, 2, 0, 2, 1, 3, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 2, 0, 0, 3, 1, 1, 2, 0, 0, 3, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 3, 0, 1, 2, 1, 2, 0, 1, 0,
        1, 2, 3, 2, 0, 1, 0, 1, 2, 3, 2, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 3, 1, 1, 1, 3,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 3, 0, 3, 0, 3, 1, 2, 1, 2, 0,
        3, 1, 0, 1, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 1, 3, 2, 1, 3, 0, 0,
        3, 2, 1, 1, 2, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 2, 3, 1, 0, 2, 1,
        3, 2, 1, 0, 2, 1, 3, 2, 1, 0, 2, 1, 3, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 2, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2,
        3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 2, 2, 0, 0, 3, 1, 1, 2, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 2, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 3, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 3, 1, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 3, 0, 3, 0, 3, 1, 2, 1, 2, 0,
        3, 1, 0, 1, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 1, 3, 2, 1, 3, 0, 0,
        3, 2, 1, 1, 2, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyx[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 3, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 3, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csx[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
const int sty[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,
        1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 1, 2, 0, 1, 1, 0, 1, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        2, 1, 2, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 1,
        0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2,
        1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 1, 2, 1, 1, 0, 0, 1, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 2, 1,
        1, 2, 0, 0, 2, 1, 1, 2, 0, 0, 2, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
        0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
        0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
        1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
        0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0,
        1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1,
        2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
        0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1,
        0, 2, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 2, 0, 1, 0,
        1, 2, 0, 1, 0, 1, 0, 1, 2, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 2, 0, 2, 1, 0, 1, 0, 0,
        1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
        2, 2, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1,
        1, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0,
        1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2,
        1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0,
        2, 1, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 1, 1, 0, 0,
        1, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyy[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csy[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
const int stz[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
        1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
        0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1,
        1, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0,
        1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,
        1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 1, 2, 0, 1, 1, 0, 1, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
        0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1,
        0, 2, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2,
        1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 2, 1,
        1, 2, 0, 0, 2, 1, 1, 2, 0, 0, 2, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 2, 0, 1, 0,
        1, 2, 0, 1, 0, 1, 0, 1, 2, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        2, 1, 2, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
        0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
        0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0,
        1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1,
        2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0,
        2, 1, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 1, 1, 0, 0,
        1, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 1,
        0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2,
        1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 1, 2, 1, 1, 0, 0, 1, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 2, 0, 2, 1, 0, 1, 0, 0,
        1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
        2, 2, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyz[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csz[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
int v;
const int N = 300000;
int getx(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return stx[v][n];
  else
    return cyx[v][(n - 30) % csx[v]];
}
int gety(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return sty[v][n];
  else
    return cyy[v][(n - 30) % csy[v]];
}
int getz(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return stz[v][n];
  else
    return cyz[v][(n - 30) % csz[v]];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  long long arr[N];
  while (t--) {
    int n, x, y, z;
    cin >> n >> x >> y >> z;
    x--;
    y--;
    z--;
    v = x + 5 * y + 25 * z;
    x++;
    y++;
    z++;
    int Xor = 0;
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      Xor ^= getx(arr[i]);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (!(Xor ^ getx(arr[i]) ^ getx(arr[i] - x))) ans++;
      if (!(Xor ^ getx(arr[i]) ^ gety(arr[i] - y))) ans++;
      if (!(Xor ^ getx(arr[i]) ^ getz(arr[i] - z))) ans++;
    }
    cout << ans << '\n';
  }
}

### Prompt

Your challenge is to write a Cpp solution to the following problem:

The Red Kingdom is attacked by the White King and the Black King!

The Kingdom is guarded by n castles, the i-th castle is defended by a_i soldiers. To conquer the Red Kingdom, the Kings have to eliminate all the defenders. 

Each day the White King launches an attack on one of the castles. Then, at night, the forces of the Black King attack a castle (possibly the same one). Then the White King attacks a castle, then the Black King, and so on. The first attack is performed by the White King.

Each attack must target a castle with at least one alive defender in it. There are three types of attacks:

  * a mixed attack decreases the number of defenders in the targeted castle by x (or sets it to 0 if there are already less than x defenders); 
  * an infantry attack decreases the number of defenders in the targeted castle by y (or sets it to 0 if there are already less than y defenders); 
  * a cavalry attack decreases the number of defenders in the targeted castle by z (or sets it to 0 if there are already less than z defenders). 



The mixed attack can be launched at any valid target (at any castle with at least one soldier). However, the infantry attack cannot be launched if the previous attack on the targeted castle had the same type, no matter when and by whom it was launched. The same applies to the cavalry attack. A castle that was not attacked at all can be targeted by any type of attack.

The King who launches the last attack will be glorified as the conqueror of the Red Kingdom, so both Kings want to launch the last attack (and they are wise enough to find a strategy that allows them to do it no matter what are the actions of their opponent, if such strategy exists). The White King is leading his first attack, and you are responsible for planning it. Can you calculate the number of possible options for the first attack that allow the White King to launch the last attack? Each option for the first attack is represented by the targeted castle and the type of attack, and two options are different if the targeted castles or the types of attack are different.

Input

The first line contains one integer t (1 ≤ t ≤ 1000) — the number of test cases.

Then, the test cases follow. Each test case is represented by two lines. 

The first line contains four integers n, x, y and z (1 ≤ n ≤ 3 ⋅ 10^5, 1 ≤ x, y, z ≤ 5). 

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^{18}).

It is guaranteed that the sum of values of n over all test cases in the input does not exceed 3 ⋅ 10^5.

Output

For each test case, print the answer to it: the number of possible options for the first attack of the White King (or 0, if the Black King can launch the last attack no matter how the White King acts).

Examples

Input


3
2 1 3 4
7 6
1 1 2 3
1
1 1 2 2
3


Output


2
3
0


Input


10
6 5 4 5
2 3 2 3 1 3
1 5 2 3
10
4 4 2 3
8 10 8 5
2 2 1 4
8 5
3 5 3 5
9 2 10
4 5 5 5
2 10 4 2
2 3 1 4
1 10
3 1 5 3
9 8 7
2 5 4 5
8 8
3 5 1 4
5 5 10


Output


0
2
1
2
5
12
5
0
0
2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int stx[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 0, 2, 1, 0, 1, 3, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 2, 0, 3, 1,
        2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 3, 1, 2, 0, 2, 3, 1, 2, 0, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
        0, 3, 1, 2, 2, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 2, 1, 3, 0, 2, 2, 1, 3, 0, 2, 2, 1, 3,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 2, 3, 1, 0, 2, 1,
        3, 2, 1, 0, 2, 1, 3, 2, 1, 0, 2, 1, 3, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 2, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 0, 2, 1, 0, 1, 3, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 3, 0, 3, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 3, 0, 0, 3, 1, 1, 3, 0, 0, 3, 1, 1, 3, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 2, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 3, 2,
        0, 2, 1, 3, 2, 0, 2, 1, 3, 2, 0, 2, 1, 3, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 2, 0, 0, 3, 1, 1, 2, 0, 0, 3, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2,
        3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 2, 2, 0, 0, 3, 1, 1, 2, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 2, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 3, 1, 2, 0, 3, 1,
        2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3, 1, 2, 0, 3,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 3, 1, 2, 0, 2, 3, 1, 2, 0, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 3, 0, 3, 1, 2, 0, 3, 1, 3, 0, 3, 1,
        3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3, 1, 3, 0, 3,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 3, 0, 0, 3, 1, 1, 3, 0, 0, 3, 1, 1, 3, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 3, 0, 1, 2, 1, 2, 0, 1, 0,
        1, 2, 3, 2, 0, 1, 0, 1, 2, 3, 2, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 3, 1, 1, 1, 3,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 3, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 3, 1, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
        0, 3, 1, 2, 2, 0, 3, 1, 2, 2, 0, 3, 1, 2, 2,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 3, 1, 3,
        0, 2, 2, 1, 3, 0, 2, 2, 1, 3, 0, 2, 2, 1, 3,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 3, 1, 0, 3, 1, 2, 3, 0, 2, 1, 3, 2,
        0, 2, 1, 3, 2, 0, 2, 1, 3, 2, 0, 2, 1, 3, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 3, 1,
        1, 2, 0, 0, 3, 1, 1, 2, 0, 0, 3, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 3, 0, 1, 2, 1, 2, 0, 1, 0,
        1, 2, 3, 2, 0, 1, 0, 1, 2, 3, 2, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 3, 1, 1, 1, 3,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 3, 0, 3, 0, 3, 1, 2, 1, 2, 0,
        3, 1, 0, 1, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 1, 3, 2, 1, 3, 0, 0,
        3, 2, 1, 1, 2, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 1, 3, 0, 1, 1, 2, 3, 1, 0, 2, 1,
        3, 2, 1, 0, 2, 1, 3, 2, 1, 0, 2, 1, 3, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 3, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        3, 1, 3, 0, 1, 2, 2, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2,
        3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 2, 2, 0, 0, 3, 1, 1, 2, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 3, 1, 1, 3, 0, 0, 2, 2, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 3, 1, 1, 2, 2, 0, 0,
        3, 1, 1, 3, 2, 0, 0, 3, 1, 1, 3, 2, 0, 0, 3,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 3, 1, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 3, 0, 3, 0, 3, 1, 2, 1, 2, 0,
        3, 1, 0, 1, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 3, 0, 0, 1, 3, 2, 1, 3, 0, 0,
        3, 2, 1, 1, 2, 0, 0, 2, 3, 1, 1, 3, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyx[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 3, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 3, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 3, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 3, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 3, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        3, 1, 1, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csx[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
const int sty[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,
        1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 1, 2, 0, 1, 1, 0, 1, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        2, 1, 2, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 1,
        0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2,
        1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 1, 2, 1, 1, 0, 0, 1, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 2, 1,
        1, 2, 0, 0, 2, 1, 1, 2, 0, 0, 2, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
        0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
        0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
        1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
        0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0,
        1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1,
        2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
        0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1,
        0, 2, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 2, 0, 1, 0,
        1, 2, 0, 1, 0, 1, 0, 1, 2, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 2, 0, 2, 1, 0, 1, 0, 0,
        1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
        2, 2, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1,
        1, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0,
        1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2,
        1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0,
        2, 1, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 1, 1, 0, 0,
        1, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyy[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csy[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
const int stz[125][30] = {
    {
        0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0,
        1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
        0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 2, 0, 0, 1, 1, 0, 0, 1,
        1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
        1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
        0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1,
        0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2,
        1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 1, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1,
        1, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0,
        1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
        0, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    },
    {
        0, 1, 2, 0, 1, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 2, 2, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,
        1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 1, 2, 0, 1, 1, 0, 1, 1, 0, 2, 1,
        0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1,
    },
    {
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
        0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
    },
    {
        0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 1, 1, 2, 0, 2, 1, 2, 0, 2, 1,
        2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
        0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1,
        0, 2, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1,
        1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2,
        1, 1, 2, 0, 1, 2, 1, 1, 2, 0, 1, 2, 1, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0,
        1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 2, 2, 0, 0,
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2,
        1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 2, 0, 2, 2, 1, 2,
        0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 2, 2, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 2, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 1, 1,
        0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 2, 0, 0, 2, 1,
        1, 2, 0, 0, 2, 1, 1, 2, 0, 0, 2, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
        0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 2, 0, 1, 0,
        1, 2, 0, 1, 0, 1, 0, 1, 2, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 1, 2, 2, 0, 0,
        2, 1, 1, 2, 2, 0, 0, 2, 1, 1, 2, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
        0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 0,
        0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 1, 1, 0,
        0, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 1, 1, 1, 1, 0, 2, 2, 2, 1,
        0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 2,
        2, 1, 2, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2,
    },
    {
        0, 1, 2, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
        0, 2, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
        0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1,
        1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 2, 2, 1, 1, 0,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0,
        2, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 2, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0,
        1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1,
        2, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 2, 0,
        0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2,
    },
    {
        0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
        0, 1, 0, 1, 2, 0, 1, 0, 1, 2, 0, 1, 0, 1, 2,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1,
        2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0,
        1, 1, 1, 2, 0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 1, 2, 0, 2, 0,
        2, 1, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 1, 2, 0,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 2, 1, 1, 0, 0,
        1, 2, 1, 1, 2, 0, 0, 2, 2, 1, 1, 2, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 1,
        0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0,
    },
    {
        0, 1, 2, 2, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2,
        1, 0, 0, 0, 1, 2, 1, 0, 0, 0, 1, 2, 1, 0, 0,
    },
    {
        0, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 0, 0, 2, 2,
        1, 1, 0, 0, 1, 2, 1, 1, 0, 0, 1, 2, 1, 1, 0,
    },
    {
        0, 1, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 0, 2, 2,
        2, 2, 1, 0, 1, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2,
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
        2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 0, 0,
        2, 2, 2, 1, 1, 0, 0, 1, 2, 2, 1, 1, 0, 0, 1,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 2, 1, 1, 0, 0, 0, 0,
        1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 0,
        0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 2, 0, 2, 1, 0, 1, 0, 0,
        1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
        2, 2, 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 2,
    },
    {
        0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0, 0,
        0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 2, 0,
    },
    {
        0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2, 1,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
        1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
    },
    {
        0, 1, 1, 2, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0,
        1, 1, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1,
    },
    {
        0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 0,
        0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2,
    },
    {
        0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 2,
        0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 0, 1, 1,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
        1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    },
};
const int cyz[125][30] = {
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 1, 1, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        2, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 0, 0, 1, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        1, 1, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
    {
        0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    },
};
const int csz[125] = {
    2, 3, 2, 5, 2, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
    3, 3, 4, 3, 3, 3, 4, 5, 6, 7, 4, 5, 5, 6, 7, 5, 6, 6, 6, 7, 6, 7, 7, 7, 7,
    4, 4, 4, 5, 2, 4, 5, 5, 6, 7, 2, 5, 6, 7, 8, 7, 6, 7, 7, 8, 2, 7, 8, 8, 8,
    5, 5, 5, 5, 6, 5, 6, 6, 6, 7, 7, 6, 7, 7, 8, 5, 6, 7, 8, 9, 3, 7, 8, 9, 9,
    6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 2, 7, 8, 8, 8, 3, 7, 8, 9, 9, 2, 7, 8, 9, 10,
};
int v;
const int N = 300000;
int getx(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return stx[v][n];
  else
    return cyx[v][(n - 30) % csx[v]];
}
int gety(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return sty[v][n];
  else
    return cyy[v][(n - 30) % csy[v]];
}
int getz(long long n) {
  n = max(n, 0LL);
  if (n < 30)
    return stz[v][n];
  else
    return cyz[v][(n - 30) % csz[v]];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  long long arr[N];
  while (t--) {
    int n, x, y, z;
    cin >> n >> x >> y >> z;
    x--;
    y--;
    z--;
    v = x + 5 * y + 25 * z;
    x++;
    y++;
    z++;
    int Xor = 0;
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      Xor ^= getx(arr[i]);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (!(Xor ^ getx(arr[i]) ^ getx(arr[i] - x))) ans++;
      if (!(Xor ^ getx(arr[i]) ^ gety(arr[i] - y))) ans++;
      if (!(Xor ^ getx(arr[i]) ^ getz(arr[i] - z))) ans++;
    }
    cout << ans << '\n';
  }
}

```