package no424; import java.util.ArrayDeque; import java.util.Queue; import java.util.Scanner; public class Main { static int[] D = {1,0,-1,0}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int w = sc.nextInt(); int[][] m = new int[h][w]; int si = sc.nextInt() - 1; int sj = sc.nextInt() - 1; int gi = sc.nextInt() - 1; int gj = sc.nextInt() - 1; for(int i=0;i q = new ArrayDeque<>(); q.offer(si * 100 + sj); used[si][sj] = true; while(!q.isEmpty()) { int c = q.poll(); int ci = c / 100; int cj = c % 100; for(int k=0;k<4;k++) { int ni = ci + D[k]; int nj = cj + D[k^1]; if (ni < 0 || ni >= h || nj < 0 || nj >= w) { continue; } if (Math.abs(m[ci][cj] - m[ni][nj]) <= 1 && !used[ni][nj]) { used[ni][nj] = true; q.offer(ni * 100 + nj); } ni += D[k]; nj += D[k^1]; if (ni < 0 || ni >= h || nj < 0 || nj >= w) { continue; } if (m[ci][cj] == m[ni][nj] && !used[ni][nj]) { used[ni][nj] = true; q.offer(ni * 100 + nj); } } } System.out.println(used[gi][gj] ? "YES" : "NO"); } }