#include using namespace std; #include #include using namespace __gnu_pbds; template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; //set // using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; // multiset static int LOCAL=0; #define length(a) (sizeof(a)/sizeof(a[0])) #define print(v,i,x) for(int j=i;j<=x;j++){cout<=n;i--) #define ROFl(i,x,n) for(lli i=x;i>=n;i--) #define debug(x) cout << " - " << #x << ": " << x << endl; #define debugs(x, y) cout << " - " << #x << ": " << x << " " << #y << ": " << y << endl; #define debugss(x, y, z) cout << " - " << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << endl; #define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL); #define cut cout<<"------------------------------------------\n"; #define cut1 cout<<"******************************************\n"; typedef vector vi; typedef vector> vii; typedef vector vlli; typedef vector vstr; typedef pair prii; typedef pair prilli; typedef pair prllii; typedef pair prllilli; const lli mod = 1000000007ll; const lli MOD = 1000000009ll; const lli INF = LLONG_MAX/10; const int inf = INT_MAX/2; lli count_bit(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;} bool check_bit(lli _mask,lli _i){lli x=1;return (_mask&(x<<_i))==0?false:true;} lli set_bit(lli _mask,lli _i){lli x=1;_mask=_mask|(x<<_i);return _mask;} lli msb(lli _mask){lli ret=-1;int cnt=0;while(_mask){if(_mask&1)ret=cnt;_mask/=2;cnt++;}return ret;} lli powermod(lli _a,lli _b,lli _m=mod){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;} lli power(lli _a,lli _b){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;} lli add(lli a,lli b,lli m=mod){lli x=a+b;while(x>=m)x-=m;return x;} lli sub(lli a,lli b,lli m=mod){lli x=a-b;while(x<0)x+=m;return x;} lli mul(lli a,lli b,lli m=mod){lli x=a*b;x%=m;return x;} lli gcd(lli a,lli b){while(a&&b)a>b?a%=b:b%=a;return a+b;} lli lcm(lli a,lli b){return (max(a,b)/gcd(a,b))*min(a,b);} struct pair_hash { std::size_t operator () (const std::pair &p) const { auto h1 = std::hash{}(p.first); auto h2 = std::hash{}(p.second); return h1 ^ h2; } }; struct cmp{ bool operator()(pair const & l,pair const & r){ return true; } }myobject; int n,x1,x2,y,y2; int dis[210][210],mvv[210][210]; prii par[210][210]; queue q; int dx[]={-2,-2,0,2,2,0}; int dy[]={-1,1,2,1,-1,-2}; stack st; string getDir(int d){ if(d==0) return "UL"; else if(d==1) return "UR"; else if(d==2) return "R"; else if(d==3) return "LR"; else if(d==4) return "LL"; else return "L"; } int main() { LOCAL=0; if(LOCAL){ freopen("C:\\Users\\Smit Patel\\Downloads\\D-large.in","r",stdin); freopen("C:\\Users\\Smit Patel\\Desktop\\out.txt","w",stdout); } si(n); si2(x1,y); si2(x2,y2); FOR(i,0,n)FOR(j,0,n)dis[i][j]=inf; dis[x1][y]=0; par[x1][y]={-1,-1}; mvv[x1][y]=-1; q.push({x1,y}); while(!q.empty()){ auto p=q.front(); q.pop(); // debugs(p.f,p.s); if(p.f==x2 && p.s==y2)break; FOR(i,0,5){ int xx=p.f+dx[i],yy=p.s+dy[i]; if(xx>=0 && xx=0 && yy