#include<iostream> #include<cstdio> #include<queue> using namespace std; struct node { int x, y; int w; }; queue<node>q; int e[6][6]; int main() { int next[4][2] = { {0, 1}, {1, 0}, {0, ...