#include using namespace std; bool success =false; int mov_i[6]={-2,-2,0,2,2,0}; int mov_j[6]={-1,1,2,1,-1,-2}; stack path,fpath; int shortest= 9999; int visited[300][300]; void copy_reverse(stack& source, stack& dest) { while(!source.empty()){ dest.push(source.top()); source.pop(); } } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end,int move) { if(i_start <0 || i_start >= n || j_start <0 || j_start >= n || (visited[i_start][j_start]!=-1 && visited[i_start][j_start] <=move ) || move >= shortest){ if(!path.empty()) path.pop(); return; } visited[i_start][j_start]=move; if(i_start==i_end && j_start ==j_end){ shortest= move; success =true; stack temp; temp= path; while(!fpath.empty()) fpath.pop(); copy_reverse(temp,fpath); path.pop(); return; } for(int i=0;i<6;i++){ path.push(i); printShortestPath(n,i_start+ mov_i[i],j_start + mov_j[i],i_end,j_end,move+1); } path.pop(); return; } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; for(int i =0;i