def mi():return map(int,input().split()) n,m=mi() si,sj=mi() si,sj=si-1,sj-1 gi,gj=mi() gi,gj=gi-1,gj-1 x=[1,0,-1,0] y=[0,1,0,-1] a=0 g=[[0]*m for _ in range(n)] def v(i,j): if not(0<=i