#include<stdio.h>
#define max 100
struct
{
int i,j;
int pre;
}qu[max];
int front=-1,rear=-1;
int mgpath(int xi,int yi,int xe,int ye)//[xe,ye]->[xi,yx]
{
int i,j,find=0,di;
rear++;
qu[rear].i=xi;qu[rear].j=yi;
qu[rear].pre=-1;
mg[1][1]=-1;
while(front<=rear &&!find)