f(){ ((v>0&v<=n&u>0&u<=n&&!h[v*n+u]++))&&{ echo $[{v,u}] read r ((r&&(s[k++]=v,s[k++]=u))) } } Black=1 read n m v=1 u=1 f for((;k;)){ ((x=s[--k],y=s[--k])) v=y+1 u=x f v=y u=x+1 f v=y u=x-1 f v=y-1 u=x f } res=(Yes No) echo ${res[!h[n*n+n]]}