import java.util.*; public class Main { static int h; static int w; static char[][] field; static boolean[][] visited; public static void main (String[] args) { Scanner sc = new Scanner(System.in); h = sc.nextInt(); w = sc.nextInt(); int sh = sc.nextInt() - 1; int sw = sc.nextInt() - 1; int gh = sc.nextInt() - 1; int gw = sc.nextInt() - 1; field = new char[h][]; visited = new boolean[h][w]; for (int i = 0; i < h; i++) { field[i] = sc.next().toCharArray(); } visit(sh, sw); if (visited[gh][gw]) { System.out.println("YES"); } else { System.out.println("NO"); } } static void visit(int hh, int ww) { if (visited[hh][ww]) { return; } visited[hh][ww] = true; if (hh > 0 && Math.abs(field[hh][ww] - field[hh - 1][ww]) <= 1) { visit(hh - 1, ww); } if (hh < h - 1 && Math.abs(field[hh][ww] - field[hh + 1][ww]) <= 1) { visit(hh + 1, ww); } if (ww > 0 && Math.abs(field[hh][ww] - field[hh][ww - 1]) <= 1) { visit(hh, ww - 1); } if (ww < w - 1 && Math.abs(field[hh][ww] - field[hh][ww + 1]) <= 1) { visit(hh, ww + 1); } if (hh > 1 && field[hh][ww] == field[hh - 2][ww] && field[hh][ww] > field[hh - 1][ww]) { visit(hh - 2, ww); } if (hh < h - 2 && field[hh][ww] == field[hh + 2][ww] && field[hh][ww] > field[hh + 1][ww]) { visit(hh + 2, ww); } if (ww > 1 && field[hh][ww] == field[hh][ww - 2] && field[hh][ww] > field[hh][ww - 1]) { visit(hh, ww - 2); } if (ww < w - 2 && field[hh][ww] == field[hh][ww + 2] && field[hh][ww] > field[hh][ww + 1]) { visit(hh, ww + 2); } } }