#include using namespace std; typedef pair i2; const int di[] = {-2,-2,0,2,2,0}; const int dj[] = {-1,1,2,1,-1,-2}; const string ds[] = {"UL","UR","R","LR","LL","L"}; const int N = 1e3 + 100; const int oo = 1e9; int n,x1,y11,x2,y2; int kt[N][N],d[N][N],loai[N * N],trace[N * N]; i2 stk[N * N / 2]; void nhap() { scanf("%d",&n); scanf("%d %d %d %d",&x1,&y11,&x2,&y2); x1++; y11++; x2++; y2++; } void truyvet(int x) { if (x == 1) { return; } truyvet(trace[x]); cout< n || y > n) {continue;} if (kt[x][y] == 0) { d[x][y] = d[u][v] + 1; kt[x][y] = 1; stk[++top] = i2(x,y); trace[top] = bot - 1; loai[top] = i; if (x == x2 && y == y2) { cout<