/*Problem link
BFS, Graph.
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;
const int maxn = 60;
const int dx[12]={0,0,0,-1,-2,-3,0,0,0,1,2,3};
const int dy[12]={-1,-2,-3,0,0,0,1,2,3,0,0,0};
const int oo = 20000000;