import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.StringTokenizer;

public class l076 {

	public static void main(String[] args) throws Exception {
//		StringTokenizer stok = new StringTokenizer(new Scanner(new File("F:/books/input.txt")).useDelimiter("\\A").next());
		StringTokenizer stok = new StringTokenizer(new Scanner(System.in).useDelimiter("\\A").next());
		StringBuilder sb = new StringBuilder();
		Integer n = Integer.parseInt(stok.nextToken());
		Integer m = Integer.parseInt(stok.nextToken());
		boolean[][] grid = new boolean[n][m];
		for(int i=0;i<n;i++) {
			String s = stok.nextToken();
			for(int j=0;j<m;j++)
				if(s.charAt(j)=='X') grid[i][j]=true;
		}
		Integer r1 = Integer.parseInt(stok.nextToken())-1;
		Integer c1 = Integer.parseInt(stok.nextToken())-1;
		Integer r2 = Integer.parseInt(stok.nextToken())-1;
		Integer c2 = Integer.parseInt(stok.nextToken())-1;
		int v = 0;
		if(r2>0 && !grid[r2-1][c2]) v++;
		if(r2<n-1 && !grid[r2+1][c2]) v++;
		if(c2>0 && !grid[r2][c2-1]) v++;
		if(c2<m-1 && !grid[r2][c2+1]) v++;
		boolean nbr = false;
		if(Math.abs(r2-r1)+Math.abs(c2-c1)==1) nbr = true;
		if((grid[r2][c2] && v<1-(nbr?1:0)) || (!grid[r2][c2] && v<2-(nbr?1:0))) System.out.println("NO");
		else {
			System.out.println(dfs(grid,r1*m+c1,r2*m+c2)?"YES":"NO");
		}
	}

	private static boolean dfs(boolean[][] grid, int s, int t) {
		ArrayDeque<Integer> S = new ArrayDeque<Integer>();
		int r = grid.length;
		int c = grid[0].length;
		boolean[] vis = new boolean[r*c];
		S.add(s);
		while(!S.isEmpty()) {
			int cur = S.pop();
			if(!vis[cur]) {
				int x = cur/c,y = cur%c;
				if(x>0) if(!grid[x-1][y]) S.push((x-1)*c+y); else vis[(x-1)*c+y]=true;
				if(x<r-1) if(!grid[x+1][y]) S.push((x+1)*c+y); else vis[(x+1)*c+y]=true;
				if(y>0) if(!grid[x][y-1]) S.push((x)*c+y-1); else vis[(x)*c+y-1]=true;
				if(y<c-1) if(!grid[x][y+1]) S.push((x)*c+y+1); else vis[(x)*c+y+1]=true;
			}
			vis[cur] = true;
		}
		return vis[t];
	}

}


import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.StringTokenizer;

public class l076 {

	public static void main(String[] args) throws Exception {
//		StringTokenizer stok = new StringTokenizer(new Scanner(new File("F:/books/input.txt")).useDelimiter("\\A").next());
		StringTokenizer stok = new StringTokenizer(new Scanner(System.in).useDelimiter("\\A").next());
		StringBuilder sb = new StringBuilder();
		Integer n = Integer.parseInt(stok.nextToken());
		Integer m = Integer.parseInt(stok.nextToken());
		boolean[][] grid = new boolean[n][m];
		for(int i=0;i<n;i++) {
			String s = stok.nextToken();
			for(int j=0;j<m;j++)
				if(s.charAt(j)=='X') grid[i][j]=true;
		}
		Integer r1 = Integer.parseInt(stok.nextToken())-1;
		Integer c1 = Integer.parseInt(stok.nextToken())-1;
		Integer r2 = Integer.parseInt(stok.nextToken())-1;
		Integer c2 = Integer.parseInt(stok.nextToken())-1;
		int v = 0;
		if(r2>0 && !grid[r2-1][c2]) v++;
		if(r2<n-1 && !grid[r2+1][c2]) v++;
		if(c2>0 && !grid[r2][c2-1]) v++;
		if(c2<m-1 && !grid[r2][c2+1]) v++;
		if((grid[r2][c2] && v<1) || (!grid[r2][c2] && v<2)) System.out.println("NO");
		else {
			System.out.println(dfs(grid,r1*m+c1,r2*m+c2)?"YES":"NO");
		}
	}

	private static boolean dfs(boolean[][] grid, int s, int t) {
		ArrayDeque<Integer> S = new ArrayDeque<Integer>();
		int r = grid.length;
		int c = grid[0].length;
		boolean[] vis = new boolean[r*c];
		S.add(s);
		while(!S.isEmpty()) {
			int cur = S.pop();
			if(!vis[cur]) {
				int x = cur/c,y = cur%c;
				if(x>0) if(!grid[x-1][y]) S.push((x-1)*c+y); else vis[(x-1)*c+y]=true;
				if(x<r-1) if(!grid[x+1][y]) S.push((x+1)*c+y); else vis[(x+1)*c+y]=true;
				if(y>0) if(!grid[x][y-1]) S.push((x)*c+y-1); else vis[(x)*c+y-1]=true;
				if(y<c-1) if(!grid[x][y+1]) S.push((x)*c+y+1); else vis[(x)*c+y+1]=true;
			}
			vis[cur] = true;
		}
		return vis[t];
	}

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P540C {

  final static int [][] DRC = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

  char [][] f = null;

  boolean canGo(int r, int c) {
    return ((r >= 0) && (c >= 0) && (r < f.length) && (c < f[r].length) && (f[r][c] == '.'));
  }

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int n = nextInt();
    int m = nextInt();
    f = new char [n][];
    for (int i = 0; i < n; i++) {
      f[i] = next().toCharArray();
    }
    int [] rc = {nextInt() - 1, nextInt() - 1};
    int [] fin = {nextInt() - 1, nextInt() - 1};

    ArrayDeque<int []> wave = new ArrayDeque();
    wave.addLast(rc);

    while (wave.size() > 0) {
      rc = wave.pollFirst();

      for (int [] drc : DRC) {
        int [] nrc = {rc[0] + drc[0], rc[1] + drc[1]};

        if ((nrc[0] == fin[0]) && (nrc[1] == fin[1]) && (f[fin[0]][fin[1]] == 'X')) {
          println("YES");
          return;
        }

        if (canGo(nrc[0], nrc[1])) {
          f[nrc[0]][nrc[1]] = 'X';
          wave.addLast(nrc);
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P540C().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P540C {

  final static int [][] DRC = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

  char [][] f = null;
  int n, m;
  int finR, finC;

  boolean trace(int r, int c) {
    for (int [] drc : DRC) {
      int nr = r + drc[0];
      int nc = c + drc[1];

      if ((nr == finR) && (nc == finC) && (f[nr][nc] == 'X')) {
        return true;
      }

      if ((nr >= 0) && (nr < n) && (nc >= 0) && (nc < m) && (f[nr][nc] == '.')) {
        f[nr][nc] = 'X';
        if (trace(nr, nc)) {
          return true;
        }
        f[nr][nc] = '.';
      }
    }

    return false;
  }

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    n = nextInt();
    m = nextInt();
    f = new char [n][];
    for (int i = 0; i < n; i++) {
      f[i] = next().toCharArray();
    }
    int r = nextInt() - 1;
    int c = nextInt() - 1;
    finR = nextInt() - 1;
    finC = nextInt() - 1;

    println(trace(r, c) ? "YES" : "NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P540C().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P540C {

  final static int [][] DRC = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

  char [][] f = null;

  boolean canGo(int r, int c) {
    return ((r >= 0) && (c >= 0) && (r < f.length) && (c < f[r].length) && (f[r][c] == '.'));
  }

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int n = nextInt();
    int m = nextInt();
    f = new char [n][];
    for (int i = 0; i < n; i++) {
      f[i] = next().toCharArray();
    }
    int [] rc = {nextInt() - 1, nextInt() - 1};
    int [] fin = {nextInt() - 1, nextInt() - 1};

    int pc = (f[fin[0]][fin[1]] == 'X') ? 1 : 0;
    for (int [] drc : DRC) {
      pc += canGo(fin[0] + drc[0], fin[1] + drc[1]) ? 1 : 0;
    }

    if (pc < 2) {
      println("NO");
      return;
    }

    ArrayDeque<int []> wave = new ArrayDeque();
    wave.addLast(rc);

    while (wave.size() > 0) {
      rc = wave.pollFirst();

      for (int [] drc : DRC) {
        int [] nrc = {rc[0] + drc[0], rc[1] + drc[1]};

        if ((nrc[0] == fin[0]) && (nrc[1] == fin[1])) {
          println("YES");
          return;
        }

        if (canGo(nrc[0], nrc[1])) {
          f[nrc[0]][nrc[1]] = 'X';
          wave.addLast(nrc);
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P540C().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P540C {

  final static int [][] DRC = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

  char [][] f = null;

  boolean canGo(int r, int c) {
    return ((r >= 0) && (c >= 0) && (r < f.length) && (c < f[r].length) && (f[r][c] == '.'));
  }

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int n = nextInt();
    int m = nextInt();
    f = new char [n][];
    for (int i = 0; i < n; i++) {
      f[i] = next().toCharArray();
    }
    int [] rc = {nextInt() - 1, nextInt() - 1};
    int [] fin = {nextInt() - 1, nextInt() - 1};

    if (((Math.abs(rc[0] - fin[0]) + Math.abs(rc[1] - fin[1])) == 1) && (f[fin[0]][fin[1]] == 'X')) {
      println("YES");
      return;
    }

    int pc = (f[fin[0]][fin[1]] == 'X') ? 1 : 0;
    for (int [] drc : DRC) {
      pc += canGo(fin[0] + drc[0], fin[1] + drc[1]) ? 1 : 0;
    }

    if (pc < 2) {
      println("NO");
      return;
    }

    ArrayDeque<int []> wave = new ArrayDeque();
    wave.addLast(rc);

    while (wave.size() > 0) {
      rc = wave.pollFirst();

      for (int [] drc : DRC) {
        int [] nrc = {rc[0] + drc[0], rc[1] + drc[1]};

        if ((nrc[0] == fin[0]) && (nrc[1] == fin[1])) {
          println("YES");
          return;
        }

        if (canGo(nrc[0], nrc[1])) {
          f[nrc[0]][nrc[1]] = 'X';
          wave.addLast(nrc);
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P540C().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class CODEFORCES {
	private InputStream is;
	private PrintWriter out;

	class Pair {
		int u, v;

		Pair(int x, int y) {
			u = x;
			v = y;
		}
	}

	void solve() {
		int n = ni(), m = ni();
		char[][] b = new char[n + 2][m + 2];
		for (int i = 0; i < b.length; i++) {
			if (i == 0 || i == b.length - 1) {
				for (int j = 0; j < b[i].length; j++)
					b[i][j] = 'X';
			} else {
				String a = ns();
				for (int j = 0; j < b[i].length; j++) {
					if (j == 0 || j == b[i].length - 1)
						b[i][j] = 'X';
					else
						b[i][j] = a.charAt(j - 1);
				}
			}
		}
		int x = ni(), y = ni(), p = ni(), q = ni();
		if (x == p && y == q) {
			out.println("NO");
			return;
		}
		boolean u[][] = new boolean[n + 2][m + 2];
		Queue<Pair> w = new LinkedList<Pair>();
		w.add(new Pair(x, y));
		while (!w.isEmpty()) {
			Pair t = w.poll();
			u[t.u][t.v] = true;
			if (b[t.u][t.v] == '.') {
				if (!u[t.u][t.v - 1])
					w.add(new Pair(t.u, t.v - 1));
				if (!u[t.u][t.v + 1])
					w.add(new Pair(t.u, t.v + 1));
				if (!u[t.u - 1][t.v])
					w.add(new Pair(t.u - 1, t.v));
				if (!u[t.u + 1][t.v])
					w.add(new Pair(t.u + 1, t.v));
			} else {
				if (t.u <= n && !u[t.u + 1][t.v])
					w.add(new Pair(t.u + 1, t.v));
			}
		}
		if (u[p][q])
			out.println("YES");
		else
			out.println("NO");
	}

	void soln() {
		is = System.in;
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new CODEFORCES().soln();
	}

	// To Get Input
	// Some Buffer Methods
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}


import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class CODEFORCES {
	private InputStream is;
	private PrintWriter out;

	class Pair {
		int u, v;

		Pair(int x, int y) {
			u = x;
			v = y;
		}
	}

	void solve() {
		int n = ni(), m = ni();
		char[][] b = new char[n + 2][m + 2];
		for (int i = 0; i < b.length; i++) {
			if (i == 0 || i == b.length - 1) {
				for (int j = 0; j < b[i].length; j++)
					b[i][j] = 'X';
			} else {
				String a = ns();
				for (int j = 0; j < b[i].length; j++) {
					if (j == 0 || j == b[i].length - 1)
						b[i][j] = 'X';
					else
						b[i][j] = a.charAt(j - 1);
				}
			}
		}
		int x = ni(), y = ni(), p = ni(), q = ni();
		boolean u[][] = new boolean[n + 2][m + 2];
		Queue<Pair> w = new LinkedList<Pair>();
		int vis[][] = new int[n + 2][m + 2];
		w.add(new Pair(x, y));
		while (!w.isEmpty()) {
			Pair t = w.poll();
			if (u[t.u][t.v])
				continue;
			u[t.u][t.v] = true;
			vis[t.u][t.v + 1]++;
			vis[t.u][t.v - 1]++;
			vis[t.u + 1][t.v]++;
			vis[t.u - 1][t.v]++;
			if (!u[t.u][t.v - 1] && b[t.u][t.v - 1] != 'X')
				w.add(new Pair(t.u, t.v - 1));
			if (!u[t.u][t.v + 1] && b[t.u][t.v + 1] != 'X')
				w.add(new Pair(t.u, t.v + 1));
			if (!u[t.u - 1][t.v] && b[t.u - 1][t.v] != 'X')
				w.add(new Pair(t.u - 1, t.v));
			if (!u[t.u + 1][t.v] && b[t.u + 1][t.v] != 'X')
				w.add(new Pair(t.u + 1, t.v));
		}
		if ((b[p][q] == 'X' && vis[p][q] >= 1) || (b[p][q] == '.' && vis[p][q] >= 2))
			out.println("YES");
		else
			out.println("NO");
	}

	void soln() {
		is = System.in;
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new CODEFORCES().soln();
	}

	// To Get Input
	// Some Buffer Methods
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}


import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class CODEFORCES {
	private InputStream is;
	private PrintWriter out;

	class Pair {
		int u, v;

		Pair(int x, int y) {
			u = x;
			v = y;
		}
	}

	void solve() {
		int n = ni(), m = ni();
		char[][] b = new char[n + 2][m + 2];
		for (int i = 0; i < b.length; i++) {
			if (i == 0 || i == b.length - 1) {
				for (int j = 0; j < b[i].length; j++)
					b[i][j] = 'X';
			} else {
				String a = ns();
				for (int j = 0; j < b[i].length; j++) {
					if (j == 0 || j == b[i].length - 1)
						b[i][j] = 'X';
					else
						b[i][j] = a.charAt(j - 1);
				}
			}
		}
		int x = ni(), y = ni(), p = ni(), q = ni();
		boolean u[][] = new boolean[n + 2][m + 2];
		Queue<Pair> w = new LinkedList<Pair>();
		w.add(new Pair(x, y));
		while (!w.isEmpty()) {
			Pair t = w.poll();
			u[t.u][t.v] = true;
			if (b[t.u][t.v] == '.') {
				if (!u[t.u][t.v - 1])
					w.add(new Pair(t.u, t.v - 1));
				if (!u[t.u][t.v + 1])
					w.add(new Pair(t.u, t.v + 1));
				if (!u[t.u - 1][t.v])
					w.add(new Pair(t.u - 1, t.v));
				if (!u[t.u + 1][t.v])
					w.add(new Pair(t.u + 1, t.v));
			} else {
				if (t.u <= n && !u[t.u + 1][t.v])
					w.add(new Pair(t.u + 1, t.v));
			}
		}
		if (u[p][q])
			out.println("YES");
		else
			out.println("NO");
	}

	void soln() {
		is = System.in;
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new CODEFORCES().soln();
	}

	// To Get Input
	// Some Buffer Methods
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}


import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class CODEFORCES {
	private InputStream is;
	private PrintWriter out;

	class Pair {
		int u, v;

		Pair(int x, int y) {
			u = x;
			v = y;
		}
	}

	void solve() {
		int n = ni(), m = ni();
		char[][] b = new char[n + 2][m + 2];
		for (int i = 0; i < b.length; i++) {
			if (i == 0 || i == b.length - 1) {
				for (int j = 0; j < b[i].length; j++)
					b[i][j] = 'X';
			} else {
				String a = ns();
				for (int j = 0; j < b[i].length; j++) {
					if (j == 0 || j == b[i].length - 1)
						b[i][j] = 'X';
					else
						b[i][j] = a.charAt(j - 1);
				}
			}
		}
		int x = ni(), y = ni(), p = ni(), q = ni();
		boolean u[][] = new boolean[n + 2][m + 2];
		Queue<Pair> w = new LinkedList<Pair>();
		int vis[][] = new int[n + 2][m + 2];
		w.add(new Pair(x, y));
		while (!w.isEmpty()) {
			Pair t = w.poll();
			u[t.u][t.v] = true;
			vis[t.u][t.v + 1]++;
			vis[t.u][t.v - 1]++;
			vis[t.u + 1][t.v]++;
			vis[t.u - 1][t.v]++;
			if (!u[t.u][t.v - 1] && b[t.u][t.v - 1] != 'X')
				w.add(new Pair(t.u, t.v - 1));
			if (!u[t.u][t.v + 1] && b[t.u][t.v + 1] != 'X')
				w.add(new Pair(t.u, t.v + 1));
			if (!u[t.u - 1][t.v] && b[t.u - 1][t.v] != 'X')
				w.add(new Pair(t.u - 1, t.v));
			if (!u[t.u + 1][t.v] && b[t.u + 1][t.v] != 'X')
				w.add(new Pair(t.u + 1, t.v));
		}
		if ((b[p][q] == 'X' && vis[p][q] >= 1) || (b[p][q] == '.' && vis[p][q] >= 2))
			out.println("YES");
		else
			out.println("NO");
	}

	void soln() {
		is = System.in;
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new CODEFORCES().soln();
	}

	// To Get Input
	// Some Buffer Methods
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}


/** https://codeforces.com/problemset/problem/540/C
 *  idea: use BFS (customized)
 */

import java.util.Scanner;
import java.util.Deque;
import java.util.LinkedList;

public class IceCave {
    static boolean isValidPoint(int x, int y, char[][] graph, boolean[][] freezeGraph) {
        if (x < 0 || x >= graph.length) return false;
        if (y < 0 || y >= graph[0].length) return false;
        if (freezeGraph[x][y]) return false;
        return true;
    }
    static boolean canReachDestinantion(Point startPoint, Point targetPoint, char[][] graph) {
        Deque<Point> queue = new LinkedList<>();
        boolean[][] freezeGraph = new boolean[graph.length][graph[0].length];
        // re-initilize start Point
        graph[startPoint.x][startPoint.y] = '.';
        queue.addLast(startPoint);
        int[] dx = {-1, 1, 0, 0};
        int[] dy = {0, 0, -1, 1};
        while(!queue.isEmpty()) {
            Point p = queue.pollFirst();
            if (p.equals(targetPoint) && graph[targetPoint.x][targetPoint.y] == 'X') {
                return true;
            }
            if (!freezeGraph[p.x][p.y]) {
                if (graph[p.x][p.y] == '.') {
                    graph[p.x][p.y] = 'X';
                    for (int i=0; i < dx.length; i++) {
                        if (isValidPoint(p.x + dx[i], p.y + dy[i], graph, freezeGraph)) {
                            queue.add(new Point(p.x + dx[i], p.y + dy[i]));
                        }
                    }
                } else {
                    freezeGraph[p.x][p.y] = true;
                }
            }
        }

        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] graph = new char[n][m];
        for (int x=0; x < graph.length; ++x) {
            String str = sc.next();
            graph[x] = str.toCharArray();
        }

        int r1 = sc.nextInt();
        int c1 = sc.nextInt();
        Point startPoint = new Point(r1-1, c1-1);
        int r2 = sc.nextInt();
        int c2 = sc.nextInt();
        Point targetPoint = new Point(r2-1, c2-1);

        if (canReachDestinantion(startPoint, targetPoint, graph)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

class Point {
    int x, y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    boolean equals(Point other) {
        return this.x == other.x && this.y == other.y;
    }
}


/** https://codeforces.com/problemset/problem/540/C
 *  idea: use BFS (customized)
 */

import java.util.Scanner;
import java.util.Deque;
import java.util.LinkedList;

public class IceCave {
    static boolean isValidPoint(int x, int y, char[][] graph) {
        if (x < 0 || x >= graph.length) return false;
        if (y < 0 || y >= graph[0].length) return false;
        return true;
    }
    static boolean canReachDestinantion(Point startPoint, Point targetPoint, char[][] graph) {
        Deque<Point> queue = new LinkedList<>();
        // re-initilize start Point
        graph[startPoint.x][startPoint.y] = '.';
        queue.addLast(startPoint);
        int[] dx = {-1, 1, 0, 0};
        int[] dy = {0, 0, -1, 1};
        while(!queue.isEmpty()) {
            Point p = queue.pollFirst();
            if (p.equals(targetPoint) && graph[targetPoint.x][targetPoint.y] == 'X') {
                return true;
            }
            if (graph[p.x][p.y] == '.') {
                graph[p.x][p.y] = 'X';
                for (int i=0; i < dx.length; i++) {
                    if (isValidPoint(p.x + dx[i], p.y + dy[i], graph)) {
                        queue.add(new Point(p.x + dx[i], p.y + dy[i]));
                    }
                }
            }
        }

        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] graph = new char[n][m];
        for (int x=0; x < graph.length; ++x) {
            String str = sc.next();
            graph[x] = str.toCharArray();
        }

        int r1 = sc.nextInt();
        int c1 = sc.nextInt();
        Point startPoint = new Point(r1-1, c1-1);
        int r2 = sc.nextInt();
        int c2 = sc.nextInt();
        Point targetPoint = new Point(r2-1, c2-1);

        if (canReachDestinantion(startPoint, targetPoint, graph)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

class Point {
    int x, y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    boolean equals(Point other) {
        return this.x == other.x && this.y == other.y;
    }
}


/** https://codeforces.com/problemset/problem/540/C
 *  idea: use BFS (customized)
 */

import java.util.Scanner;
import java.util.Deque;
import java.util.LinkedList;

public class IceCave {
    static boolean isValidPoint(int x, int y, char[][] graph, boolean[][] visitedGraph) {
        if (x < 0 || x >= graph.length) return false;
        if (y < 0 || y >= graph[0].length) return false;
        if (visitedGraph[x][y]) return false;
        return true;
    }
    static boolean canReachDestinantion(Point startPoint, Point targetPoint, char[][] graph) {
        Deque<Point> queue = new LinkedList<>();
        boolean[][] visitedGraph = new boolean[graph.length][graph[0].length];
        // re-initilize start Point
        graph[startPoint.x][startPoint.y] = '.';
        queue.addLast(startPoint);
        int[] dx = {-1, 1, 0, 0};
        int[] dy = {0, 0, -1, 1};
        while(!queue.isEmpty()) {
            Point p = queue.pollFirst();
            if (p.equals(targetPoint) && graph[targetPoint.x][targetPoint.y] == 'X') {
                return true;
            }
            if (!visitedGraph[p.x][p.y]) {
                if (graph[p.x][p.y] == '.') {
                    graph[p.x][p.y] = 'X';
                } else {
                    visitedGraph[p.x][p.y] = true;
                }
            }

            if (visitedGraph[p.x][p.y]) {
                continue;
            }
            for (int i=0; i < dx.length; i++) {
                if (isValidPoint(p.x + dx[i], p.y + dy[i], graph, visitedGraph)) {
                    queue.add(new Point(p.x + dx[i], p.y + dy[i]));
                }
            }
        }

        return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] graph = new char[n][m];
        for (int x=0; x < graph.length; ++x) {
            String str = sc.next();
            graph[x] = str.toCharArray();
        }

        int r1 = sc.nextInt();
        int c1 = sc.nextInt();
        Point startPoint = new Point(r1-1, c1-1);
        int r2 = sc.nextInt();
        int c2 = sc.nextInt();
        Point targetPoint = new Point(r2-1, c2-1);

        if (canReachDestinantion(startPoint, targetPoint, graph)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

class Point {
    int x, y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    boolean equals(Point other) {
        return this.x == other.x && this.y == other.y;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingQueue;

public class IceCave {
	public static void main( String args[]) throws InterruptedException
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		int n = in.nextInt(), m = in.nextInt();
		char[][] map = new char[  n + 2 ][ m + 2];
		boolean[][] visited  = new boolean[ n+2 ][ m+2 ];
		int[] dR = {1, -1, 0, 0};
		int[] dC = {0, 0, 1, -1};

		for(int i = 0; i < n + 2; i++)
		{
			map[i][0]   = 'X';
			map[i][m+1] = 'X';
		}

		for(int i = 0; i < m + 2; i++)
		{
			map[0][i]   = 'X';
			map[n+1][i] = 'X';
		}

		String input;
		for(int i = 1; i < n + 1; i++ )
		{
			input = in.next();
			for( int j = 1; j < m + 1; j++ )
			{
				map[i][j] = input.charAt(j-1);
			}
		}

		int r1 = in.nextInt(), c1 = in.nextInt();
		int r2 = in.nextInt(), c2 = in.nextInt();

		if(r1 == r2 && c1 == c2)
		{
			for(int i = 0; i < 4; i++)
			{
				if( map[r1 + dR[i]][c1 + dC[i]] == '.')
				{
					out.println("YES");
					out.flush();
					return;
				}
			}

			out.println("NO");
			out.flush();
			return;
		}

		LinkedBlockingQueue<Node> queue = new LinkedBlockingQueue<Node>();
		queue.add(new Node(r1, c1));
		Node current = null;

		while(!queue.isEmpty())
		{
			current = queue.take();
			visited[current.r][current.c] = true;
			if(current.r == r2 && current.c == c2)
			{
				if(map[r2][c2] == 'X')
				{
					out.println("YES");
					out.flush();
					return;
				}
				else
				{
					for(int i = 0; i < 4; i++)
					{
						if( map[r2 + dR[i]][c2 + dC[i]] == '.' && visited[r2 + dR[i]][c2 + dR[i]] == false)
						{
							out.println("YES");
							out.flush();
							return;
						}
					}

					out.println("NO");
					out.flush();
					return;
				}
			}

			for(int j = 0; j < 4; j++)
			{
				int curRow = current.r + dR[j];
				int curCol = current.c + dC[j];
				if( ( !visited[curRow][curCol] && map[curRow][curCol] == '.' ) || (curRow == r2 && curCol == c2) )
				{
					queue.add( new Node(curRow, curCol) );
					visited[curRow][curCol] = true;
				}
			}
		}

		out.println("NO");
		out.flush();

	}

	private static class Node
	{
		int r, c;

		public Node( int r, int c )
		{
			this.r = r;
			this.c = c;
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream), 32768);
	        tokenizer = null;
	    }

	    public String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingQueue;

public class IceCave {
	public static void main( String args[]) throws InterruptedException
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		int n = in.nextInt(), m = in.nextInt();
		char[][] map = new char[  n + 2 ][ m + 2];
		boolean[][] visited  = new boolean[ n+2 ][ m+2 ];
		int[] dR = {1, -1, 0, 0};
		int[] dC = {0, 0, 1, -1};

		for(int i = 0; i < n + 2; i++)
		{
			map[i][0]   = 'X';
			map[i][m+1] = 'X';
		}

		for(int i = 0; i < m + 2; i++)
		{
			map[0][i]   = 'X';
			map[n+1][i] = 'X';
		}

		String input;
		for(int i = 1; i < n + 1; i++ )
		{
			input = in.next();
			for( int j = 1; j < m + 1; j++ )
			{
				map[i][j] = input.charAt(j-1);
			}
		}

		int r1 = in.nextInt(), c1 = in.nextInt();
		int r2 = in.nextInt(), c2 = in.nextInt();

		if(r1 == r2 && c1 == c2)
		{
			for(int i = 0; i < 4; i++)
			{
				if( map[r1 + dR[i]][c1 + dC[i]] == '.')
				{
					out.println("YES");
					out.flush();
					return;
				}
			}

			out.println("NO");
			out.flush();
			return;
		}

		LinkedBlockingQueue<Node> queue = new LinkedBlockingQueue<Node>();
		queue.add(new Node(r1, c1));
		Node current = null;

		while(!queue.isEmpty())
		{
			current = queue.take();
			visited[current.r][current.c] = true;
			if(current.r == r2 && current.c == c2)
			{
				if(map[r2][c2] == 'X')
				{
					out.println("YES");
					out.flush();
					return;
				}
				else
				{
					for(int i = 0; i < 4; i++)
					{
						if( map[r2 + dR[i]][c2 + dC[i]] == '.' && visited[r2 + dR[i]][c2 + dC[i]] == false)
						{
							out.println("YES");
							out.flush();
							return;
						}
					}

					out.println("NO");
					out.flush();
					return;
				}
			}

			for(int j = 0; j < 4; j++)
			{
				int curRow = current.r + dR[j];
				int curCol = current.c + dC[j];
				if( ( !visited[curRow][curCol] && map[curRow][curCol] == '.' ) || (curRow == r2 && curCol == c2) )
				{
					queue.add( new Node(curRow, curCol) );
					visited[curRow][curCol] = true;
				}
			}
		}

		out.println("NO");
		out.flush();

	}

	private static class Node
	{
		int r, c;

		public Node( int r, int c )
		{
			this.r = r;
			this.c = c;
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream), 32768);
	        tokenizer = null;
	    }

	    public String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingQueue;

public class IceCave {
	public static void main( String args[]) throws InterruptedException
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		int n = in.nextInt(), m = in.nextInt();
		char[][] map = new char[  n + 2 ][ m + 2];
		boolean[][] visited  = new boolean[ n+2 ][ m+2 ];
		int[] dR = {1, -1, 0, 0};
		int[] dC = {0, 0, 1, -1};

		for(int i = 0; i < n + 2; i++)
		{
			map[i][0]   = 'X';
			map[i][m+1] = 'X';
		}

		for(int i = 0; i < m + 2; i++)
		{
			map[0][i]   = 'X';
			map[n+1][i] = 'X';
		}

		String input;
		for(int i = 1; i < n + 1; i++ )
		{
			input = in.next();
			for( int j = 1; j < m + 1; j++ )
			{
				map[i][j] = input.charAt(j-1);
			}
		}

		int r1 = in.nextInt(), c1 = in.nextInt();
		int r2 = in.nextInt(), c2 = in.nextInt();

		if(r1 == r2 && c1 == c2)
		{
			for(int i = 0; i < 4; i++)
			{
				if( map[r1 + dR[i]][c1 + dC[i]] == '.')
				{
					out.println("YES");
					out.flush();
					return;
				}
			}

			out.println("NO");
			out.flush();
			return;
		}

		LinkedBlockingQueue<Node> queue = new LinkedBlockingQueue<Node>();
		queue.add(new Node(r1, c1));
		Node current = null;
		int count = 0;

		while(!queue.isEmpty())
		{
			current = queue.take();
			visited[current.r][current.c] = true;
			if(current.r == r2 && current.c == c2)
			{
				if(map[r2][c2] == 'X')
				{
					out.println("YES");
					out.flush();
					return;
				}
				else
				{
					for(int i = 0; i < 4; i++)
					{
						if( map[r2 + dR[i]][c2 + dC[i]] == '.' && visited[r2 + dR[i]][c2 + dC[i]] == false)
						{
							out.println("YES");
							out.flush();
							return;
						}

						if(map[r2 + dR[i]][c2 + dC[i]] == '.' && visited[r2 + dR[i]][c2 + dC[i]] == true)
						{
							count++;
							if(count >= 2 )
							{
								out.println("YES");
								out.flush();
								return;
							}
						}
					}

					out.println("NO");
					out.flush();
					return;
				}
			}

			for(int j = 0; j < 4; j++)
			{
				int curRow = current.r + dR[j];
				int curCol = current.c + dC[j];
				if( ( !visited[curRow][curCol] && map[curRow][curCol] == '.' ) || (curRow == r2 && curCol == c2) )
				{
					queue.add( new Node(curRow, curCol) );
					visited[curRow][curCol] = true;
				}
			}
		}

		out.println("NO");
		out.flush();

	}

	private static class Node
	{
		int r, c;

		public Node( int r, int c )
		{
			this.r = r;
			this.c = c;
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream), 32768);
	        tokenizer = null;
	    }

	    public String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	}

}


import java.util.*;

public class ques3 {
    public static void main(String[] args) throws Exception{
        Scanner in=new Scanner(System.in);
        String []s=new String[501];
        int n,m,i,j;
        n=in.nextInt(); m=in.nextInt();
        int [][]arr=new int[n+1][m+1];
        for(i=0;i<n;i++)
            s[i]=in.next();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(s[i].charAt(j)=='X')
                    arr[i][j]=1;
                else
                    arr[i][j]=0;
            }
        }
        int sx,sy,ex,ey;
        sx=in.nextInt(); sy=in.nextInt();
        ex=in.nextInt(); ey=in.nextInt();
        DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
        obj.dfs(sx,sy);
        obj.solve();
        in.close();
    }

}

class DFS{
    int n,m,sx,sy,ex,ey;
    int [][]gph=new int[n][m];
    public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
        n=x; m=y;
        sx=a; sy=b; ex=c; ey=d;
        gph=arr;
    }
    int [][]visited=new int[501][501];
    int []dx={-1,1,0,0};
    int []dy={0,0,-1,1};

    int safe(int x,int y){
        if(x<n&&x>=0&&y>=0&&y<m)    return 1;
        return 0;
    }

    void dfs(int si,int sj){
         visited[si][sj]=1;
         int i;
         for(i=0;i<4;i++){
             int ei=si+dx[i];
             int ej=sj+dy[i];
             int k=safe(ei,ej);
             if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
                 dfs(ei,ej);
             if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
                 dfs(ei,ej);
         }
    }
    void solve(){
        if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-ex)==1&&ex==sx))){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(visited[ex][ey]==1){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=2)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else
            System.out.println("NO");
    }
}


import java.util.*;

public class ques3 {
	public static void main(String[] args) throws Exception{
		Scanner in=new Scanner(System.in);
		String []s=new String[501];
		int n,m,i,j;
		n=in.nextInt(); m=in.nextInt();
		int [][]arr=new int[n+1][m+1];
		for(i=0;i<n;i++)
			s[i]=in.next();
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(s[i].charAt(j)=='X')
					arr[i][j]=1;
				else
					arr[i][j]=0;
			}
		}
		int sx,sy,ex,ey;
		sx=in.nextInt(); sy=in.nextInt();
		ex=in.nextInt(); ey=in.nextInt();
		DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
		obj.dfs(sx,sy);
		obj.solve();
		in.close();
	}

}

class DFS{
	int n,m,sx,sy,ex,ey;
	int [][]gph=new int[n][m];
	public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
		n=x; m=y;
		sx=a; sy=b; ex=c; ey=d;
		gph=arr;
	}
	int [][]visited=new int[501][501];
	int []dx={-1,1,0,0};
	int []dy={0,0,-1,1};

	int safe(int x,int y){
		if(x<n&&x>=0&&y>=0&&y<m)	return 1;
		return 0;
	}

	void dfs(int si,int sj){
		 visited[si][sj]=1;
		 int i;
		 for(i=0;i<4;i++){
			 int ei=si+dx[i];
			 int ej=sj+dy[i];
			 int k=safe(ei,ej);
			 if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
				 dfs(ei,ej);
			 if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
				 dfs(ei,ej);
		 }
	}
	void solve(){
		if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
			int co=0;
			for(int i=0;i<4;i++)
			{
				int ei=ex+dx[i];
				int ej=ey+dy[i];
				int k=safe(ei,ej);
				if(k==1&&gph[ei][ej]==0)
					co++;
			}
			if(co>=1)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-ex)==1&&ex==sx))){
			int co=0;
			for(int i=0;i<4;i++)
			{
				int ei=ex+dx[i];
				int ej=ey+dy[i];
				int k=safe(ei,ej);
				if(k==1&&gph[ei][ej]==0)
					co++;
			}
			if(co>=1)
				System.out.println("YES");
			else if(gph[ex][ey]==1)
				System.out.println("YES");
			else
				System.out.println("NO");

		}
		else if(visited[ex][ey]==1){
			int co=0;
			for(int i=0;i<4;i++)
			{
				int ei=ex+dx[i];
				int ej=ey+dy[i];
				int k=safe(ei,ej);
				if(k==1&&gph[ei][ej]==0)
					co++;
			}
			if(co>=2)
				System.out.println("YES");
			else if(gph[ex][ey]==1)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else
			System.out.println("NO1");
	}
}


import java.util.*;

public class ques3 {
    public static void main(String[] args) throws Exception{
        Scanner in=new Scanner(System.in);
        String []s=new String[501];
        int n,m,i,j;
        n=in.nextInt(); m=in.nextInt();
        int [][]arr=new int[n+1][m+1];
        for(i=0;i<n;i++)
            s[i]=in.next();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(s[i].charAt(j)=='X')
                    arr[i][j]=1;
                else
                    arr[i][j]=0;
            }
        }
        int sx,sy,ex,ey;
        sx=in.nextInt(); sy=in.nextInt();
        ex=in.nextInt(); ey=in.nextInt();
        DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
        obj.dfs(sx-1,sy-1);
        obj.solve();
        in.close();
    }

}

class DFS{
    int n,m,sx,sy,ex,ey;
    int [][]gph=new int[n][m];
    public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
        n=x; m=y;
        sx=a; sy=b; ex=c; ey=d;
        gph=arr;
    }
    int [][]visited=new int[501][501];
    int []dx={-1,1,0,0};
    int []dy={0,0,-1,1};

    int safe(int x,int y){
        if(x<n&&x>=0&&y>=0&&y<m)    return 1;
        return 0;
    }

    void dfs(int si,int sj){
         visited[si][sj]=1;
         int i;
         for(i=0;i<4;i++){
             int ei=si+dx[i];
             int ej=sj+dy[i];
             int k=safe(ei,ej);
             if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
                 dfs(ei,ej);
             if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
                 dfs(ei,ej);
         }
    }
    void solve(){
        if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-sy)==1&&ex==sx))){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO1");

        }
        else if(visited[ex][ey]==1){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=2)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else
            System.out.println("NO");
    }
}


import java.util.*;

public     class DFS{
    int n,m,sx,sy,ex,ey;
    int [][]gph=new int[n][m];
    public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
        n=x; m=y;
        sx=a; sy=b; ex=c; ey=d;
        gph=arr;
    }
    int [][]visited=new int[501][501];
    int []dx={-1,1,0,0};
    int []dy={0,0,-1,1};

    int safe(int x,int y){
        if(x<n&&x>=0&&y>=0&&y<m)    return 1;
        return 0;
    }

    void dfs(int si,int sj){
         visited[si][sj]=1;
         int i;
         for(i=0;i<4;i++){
             int ei=si+dx[i];
             int ej=sj+dy[i];
             int k=safe(ei,ej);
             if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
                 dfs(ei,ej);
             if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
                 dfs(ei,ej);
         }
    }
    void solve(){
        if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-ex)==1&&ex==sx))){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(visited[ex][ey]==1){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=2)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else
            System.out.println("NO1");
    }
}

public class ques3 {
    public static void main(String[] args) throws Exception{
        Scanner in=new Scanner(System.in);
        String []s=new String[501];
        int n,m,i,j;
        n=in.nextInt(); m=in.nextInt();
        int [][]arr=new int[n+1][m+1];
        for(i=0;i<n;i++)
            s[i]=in.next();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(s[i].charAt(j)=='X')
                    arr[i][j]=1;
                else
                    arr[i][j]=0;
            }
        }
        int sx,sy,ex,ey;
        sx=in.nextInt(); sy=in.nextInt();
        ex=in.nextInt(); ey=in.nextInt();
        DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
        obj.dfs(sx,sy);
        obj.solve();
        in.close();
    }

}


import java.util.*;

public class ques3 {
    public static void main(String[] args) throws Exception{
        Scanner in=new Scanner(System.in);
        String []s=new String[501];
        int n,m,i,j;
        n=in.nextInt(); m=in.nextInt();
        int [][]arr=new int[n+1][m+1];
        for(i=0;i<n;i++)
            s[i]=in.next();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(s[i].charAt(j)=='X')
                    arr[i][j]=1;
                else
                    arr[i][j]=0;
            }
        }
        int sx,sy,ex,ey;
        sx=in.nextInt(); sy=in.nextInt();
        ex=in.nextInt(); ey=in.nextInt();
        DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
        obj.dfs(sx-1,sy-1);
        obj.solve();
        in.close();
    }

}

class DFS{
    int n,m,sx,sy,ex,ey;
    int [][]gph=new int[n][m];
    public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
        n=x; m=y;
        sx=a; sy=b; ex=c; ey=d;
        gph=arr;
    }
    int [][]visited=new int[501][501];
    int []dx={-1,1,0,0};
    int []dy={0,0,-1,1};

    int safe(int x,int y){
        if(x<n&&x>=0&&y>=0&&y<m)    return 1;
        return 0;
    }

    void dfs(int si,int sj){
         visited[si][sj]=1;
         int i;
         for(i=0;i<4;i++){
             int ei=si+dx[i];
             int ej=sj+dy[i];
             int k=safe(ei,ej);
             if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
                 dfs(ei,ej);
             if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
                 dfs(ei,ej);
         }
    }
    void solve(){
        if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-ex)==1&&ex==sx))){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(visited[ex][ey]==1){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=2)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else
            System.out.println("NO");
    }
}


import java.util.*;

public class ques3 {
    public static void main(String[] args) throws Exception{
        Scanner in=new Scanner(System.in);
        String []s=new String[501];
        int n,m,i,j;
        n=in.nextInt(); m=in.nextInt();
        int [][]arr=new int[n+1][m+1];
        for(i=0;i<n;i++)
            s[i]=in.next();
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(s[i].charAt(j)=='X')
                    arr[i][j]=1;
                else
                    arr[i][j]=0;
            }
        }
        int sx,sy,ex,ey;
        sx=in.nextInt(); sy=in.nextInt();
        ex=in.nextInt(); ey=in.nextInt();
        DFS obj=new DFS(n,m,sx-1,sy-1,ex-1,ey-1,arr);
        obj.dfs(sx-1,sy-1);
        obj.solve();
        in.close();
    }

}

class DFS{
    int n,m,sx,sy,ex,ey;
    int [][]gph=new int[n][m];
    public DFS(int x,int y,int a,int b,int c,int d,int arr[][]){
        n=x; m=y;
        sx=a; sy=b; ex=c; ey=d;
        gph=arr;
    }
    int [][]visited=new int[501][501];
    int []dx={-1,1,0,0};
    int []dy={0,0,-1,1};

    int safe(int x,int y){
        if(x<n&&x>=0&&y>=0&&y<m)    return 1;
        return 0;
    }

    void dfs(int si,int sj){
         visited[si][sj]=1;
         int i;
         for(i=0;i<4;i++){
             int ei=si+dx[i];
             int ej=sj+dy[i];
             int k=safe(ei,ej);
             if(k==1 && (visited[ei][ej]==0) && (gph[ei][ej]==0))
                 dfs(ei,ej);
             if(k==1 && visited[ei][ej]==0 && gph[ei][ej]==1 &&ei==ex && ej==ey)
                 dfs(ei,ej);
         }
    }
    void solve(){
        if(visited[ex][ey]==1&&(sx==ex&&sy==ey)){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(visited[ex][ey]==1&&((Math.abs(sx-ex)==1&&ey==sy)||(Math.abs(ey-sy)==1&&ex==sx))){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=1)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(visited[ex][ey]==1){
            int co=0;
            for(int i=0;i<4;i++)
            {
                int ei=ex+dx[i];
                int ej=ey+dy[i];
                int k=safe(ei,ej);
                if(k==1&&gph[ei][ej]==0)
                    co++;
            }
            if(co>=2)
                System.out.println("YES");
            else if(gph[ex][ey]==1)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else
            System.out.println("NO");
    }
}


import java.util.Scanner;
import java.util.Stack;

public class Prblm {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, m;
        n = sc.nextInt();
        m = sc.nextInt();
        sc.nextLine();
        String temp_line;
        char[][] cage = new char[n][m];
        boolean[][] visited = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            temp_line = sc.nextLine();
            for (int j = 0; j < m; j++) {
                cage[i][j] = temp_line.charAt(j);
            }
        }
        int i1 = sc.nextInt()-1;
        int j1 = sc.nextInt()-1;
        int i2 = sc.nextInt()-1;
        int j2 = sc.nextInt()-1;
        if (is_path_exist(cage, visited, i1, j1, i2, j2)) {
            if (cage[i2][j2] == 'X') {
                System.out.println("YES");
                return;
            }
            int count = 0;
            try {
                if (cage[i2][j2 + 1] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2][j2 - 1] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 + 1][j2] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 - 1][j2] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            if (count > 1) {
                System.out.println("YES");
            }
            else {
            System.out.println("NO");
        }
        } else {
            System.out.println("NO");
        }

    }

    static boolean is_path_exist(char[][] cage, boolean[][] visited, int i1, int j1, int i2, int j2) {
        int[] dx = {0, 0, -1, 1};
        int[] dy = {-1, 1, 0, 0};
        int[] temp_point;
        boolean reached = false;
        Stack<int[]> stk = new Stack<int[]>();
        stk.push(new int[]{i1, j1});
        cage[i1][j1] = 'X';
        while (!stk.isEmpty() && !reached) {
            temp_point = stk.pop();
            for (int i = 0; i < 4; i++) {
                if ((temp_point[0] + dx[i] > -1 && temp_point[0] + dx[i] < cage.length)
                        && (temp_point[1] + dy[i] > -1 && temp_point[1] + dy[i] < cage[0].length)
                        && visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] == false) {
                    if (temp_point[0] + dx[i] == i2 && temp_point[1] + dy[i] == j2) {
                        reached = true;
                        break;
                    }
                    if(cage[temp_point[0] + dx[i]][temp_point[1] + dy[i]] != 'X'){
                    visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] = true;
                    stk.push(new int[]{temp_point[0] + dx[i], temp_point[1] + dy[i]});}
                }
            }
        }
        return reached;
    }
}


import java.util.Scanner;
import java.util.Stack;

public class Prblm {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, m;
        n = sc.nextInt();
        m = sc.nextInt();
        sc.nextLine();
        String temp_line;
        char[][] cage = new char[n][m];
        boolean[][] visited = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            temp_line = sc.nextLine();
            for (int j = 0; j < m; j++) {
                cage[i][j] = temp_line.charAt(j);
            }
        }
        int i1 = sc.nextInt()-1;
        int j1 = sc.nextInt()-1;
        int i2 = sc.nextInt()-1;
        int j2 = sc.nextInt()-1;
        if (is_path_exist(cage, visited, i1, j1, i2, j2)) {
            if (cage[i2][j2] == 'X') {
                System.out.println("YES");
                return;
            }
            int count = 0;
            try {
                if (cage[i2][j2 + 1] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2][j2 - 1] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 + 1][j2] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 - 1][j2] == '.') {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            if (count > 1) {
                System.out.println("YES");
            }
            else {
            System.out.println("NO");
        }
        } else {
            System.out.println("NO");
        }

    }

    static boolean is_path_exist(char[][] cage, boolean[][] visited, int i1, int j1, int i2, int j2) {
        int[] dx = {0, 0, -1, 1};
        int[] dy = {-1, 1, 0, 0};
        int[] temp_point;
        boolean reached = false;
        Stack<int[]> stk = new Stack<int[]>();
        stk.push(new int[]{i1, j1});
        cage[i1][j1] = 'X';
        while (!stk.isEmpty() && !reached) {
            temp_point = stk.pop();
            for (int i = 0; i < 4; i++) {
                if ((temp_point[0] + dx[i] > -1 && temp_point[0] + dx[i] < cage.length)
                        && (temp_point[1] + dy[i] > -1 && temp_point[1] + dy[i] < cage[0].length)
                        && visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] == false
                        && cage[temp_point[0] + dx[i]][temp_point[1] + dy[i]] != 'X') {
                    if (temp_point[0] + dx[i] == i2 && temp_point[1] + dy[i] == j2) {
                        reached = true;
                        break;
                    }
                    visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] = true;
                    stk.push(new int[]{temp_point[0] + dx[i], temp_point[1] + dy[i]});
                }
            }
        }
        return reached;
    }
}


import java.util.Scanner;
import java.util.Stack;

public class Prblm {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] dx = {0, 0, -1, 1};
        int[] dy = {-1, 1, 0, 0};
        int n, m;
        n = sc.nextInt();
        m = sc.nextInt();
        sc.nextLine();
        String temp_line;
        char[][] cage = new char[n][m];
        boolean[][] visited = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            temp_line = sc.nextLine();
            for (int j = 0; j < m; j++) {
                cage[i][j] = temp_line.charAt(j);
            }
        }
        int i1 = sc.nextInt() - 1;
        int j1 = sc.nextInt() - 1;
        int i2 = sc.nextInt() - 1;
        int j2 = sc.nextInt() - 1;
        if (is_path_exist(cage, visited, i1, j1, i2, j2)) {
            if (cage[i2][j2] == 'X') {
                System.out.println("YES");
                return;
            }
            int count = 0;
            for (int i = 0; i < 4; i++) {
                if (i2 + dx[i] > -1 && i2 + dx[i] < cage.length && j2 + dy[i] > -1 && j2 + dy[i] < cage[0].length
                        && (cage[i2 + dx[i]][j2 + dy[i]] == '.' || (i2 + dx[i] == i1 && j2 + dy[i] == j1)) ) {
                    count++;
                }
            }
            if (count > 1) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        } else {
            System.out.println("NO");
        }

    }

    static boolean is_path_exist(char[][] cage, boolean[][] visited, int i1, int j1, int i2, int j2) {
        int[] dx = {0, 0, -1, 1};
        int[] dy = {-1, 1, 0, 0};
        int[] temp_point;
        boolean reached = false;
        Stack<int[]> stk = new Stack<int[]>();
        stk.push(new int[]{i1, j1});
        cage[i1][j1] = 'X';
        while (!stk.isEmpty() && !reached) {
            temp_point = stk.pop();
            for (int i = 0; i < 4; i++) {
                if ((temp_point[0] + dx[i] > -1 && temp_point[0] + dx[i] < cage.length)
                        && (temp_point[1] + dy[i] > -1 && temp_point[1] + dy[i] < cage[0].length)
                        && visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] == false) {
                    if (temp_point[0] + dx[i] == i2 && temp_point[1] + dy[i] == j2) {
                        reached = true;
                        break;
                    }
                    if (cage[temp_point[0] + dx[i]][temp_point[1] + dy[i]] != 'X') {
                        visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] = true;
                        stk.push(new int[]{temp_point[0] + dx[i], temp_point[1] + dy[i]});
                    }
                }
            }
        }
        return reached;
    }
}


import java.util.Scanner;
import java.util.Stack;

public class Prblm {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, m;
        n = sc.nextInt();
        m = sc.nextInt();
        sc.nextLine();
        String temp_line;
        char[][] cage = new char[n][m];
        boolean[][] visited = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            temp_line = sc.nextLine();
            for (int j = 0; j < m; j++) {
                cage[i][j] = temp_line.charAt(j);
            }
        }
        int i1 = sc.nextInt()-1;
        int j1 = sc.nextInt()-1;
        int i2 = sc.nextInt()-1;
        int j2 = sc.nextInt()-1;
        if (is_path_exist(cage, visited, i1, j1, i2, j2)) {
            if (cage[i2][j2] == 'X') {
                System.out.println("YES");
                return;
            }
            int count = 0;
            try {
                if (cage[i2][j2 + 1] == '.'||(i2==i1&&j2+1==j1)) {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2][j2 - 1] == '.'||(i2==i1&&j2-1==j1)) {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 + 1][j2] == '.'||(i2+1==i1&&j2==j1)) {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            try {
                if (cage[i2 - 1][j2] == '.'||(i2-1==i1&&j2==j1)) {
                    count++;
                }
            } catch (ArrayIndexOutOfBoundsException ex) {
            }
            if (count > 1) {
                System.out.println("YES");
            }
            else {
            System.out.println("NO");
        }
        } else {
            System.out.println("NO");
        }

    }

    static boolean is_path_exist(char[][] cage, boolean[][] visited, int i1, int j1, int i2, int j2) {
        int[] dx = {0, 0, -1, 1};
        int[] dy = {-1, 1, 0, 0};
        int[] temp_point;
        boolean reached = false;
        Stack<int[]> stk = new Stack<int[]>();
        stk.push(new int[]{i1, j1});
        cage[i1][j1] = 'X';
        while (!stk.isEmpty() && !reached) {
            temp_point = stk.pop();
            for (int i = 0; i < 4; i++) {
                if ((temp_point[0] + dx[i] > -1 && temp_point[0] + dx[i] < cage.length)
                        && (temp_point[1] + dy[i] > -1 && temp_point[1] + dy[i] < cage[0].length)
                        && visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] == false) {
                    if (temp_point[0] + dx[i] == i2 && temp_point[1] + dy[i] == j2) {
                        reached = true;
                        break;
                    }
                    if(cage[temp_point[0] + dx[i]][temp_point[1] + dy[i]] != 'X'){
                    visited[temp_point[0] + dx[i]][temp_point[1] + dy[i]] = true;
                    stk.push(new int[]{temp_point[0] + dx[i], temp_point[1] + dy[i]});}
                }
            }
        }
        return reached;
    }
}


//code written by a living bruh moment
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.*;

public class Rating2000_540C {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int m = in.nextInt();
        char[][] grid = new char[n][m];
        for(int i = 0; i<n; i++){
            String s = in.next();
            for(int j = 0; j<m; j++){
                grid[i][j] = s.charAt(j);
            }
        }
        int startn = in.nextInt()-1;
        int startm = in.nextInt()-1;
        int endn = in.nextInt()-1;
        int endm = in.nextInt()-1;
        boolean cracked = false;
        if(grid[endn][endm] == 'X') cracked = true;
        boolean path = false;
        boolean doit = true;
        Queue<Integer> x = new LinkedList<Integer>();
        Queue<Integer> y = new LinkedList<Integer>();
        x.add(startn);
        y.add(startm);
        //bfs
        while(!x.isEmpty() && !y.isEmpty()){
            startn = x.poll();
            startm = y.poll();
            if(startn==endn && startm==endm){
                path = true;
                break;
            }
            if(startn<0 || startm<0 || startn>=grid.length || startm>=grid[0].length){

            }
            else if(grid[startn][startm] == 'X' && !doit){
            }
            else{
                doit=false;
                grid[startn][startm] = 'X';
                x.add(startn+1);
                x.add(startn-1);
                x.add(startn);
                x.add(startn);
                y.add(startm);
                y.add(startm);
                y.add(startm+1);
                y.add(startm-1);
            }
        }
        if(path){
            if(cracked){
                out.print("YES");
            }
            else{
                int count = 0;
                int l = endn + 1;
                int r = endm;
                if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

                }
                else if(grid[l][r] == '.'){
                    ++count;
                }
                l = endn - 1;
                r = endm;
                if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

                }
                else if(grid[l][r] == '.'){
                    ++count;
                }
                l = endn;
                r = endm + 1;
                if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

                }
                else if(grid[l][r] == '.'){
                    ++count;
                }
                l = endn;
                r = endm - 1;
                if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

                }
                else if(grid[l][r] == '.'){
                    ++count;
                }
                if(count>=2){
                    out.print("YES");
                }
                else{
                    out.print("NO");
                }
            }
        }
        else{
            out.print("NO");
        }
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}


//code written by a living bruh moment
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.*;

public class Rating2000_540C {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        int m = in.nextInt();
        char[][] grid = new char[n][m];
        char[][] grid2 = new char[n][m];
        for(int i = 0; i<n; i++){
            String s = in.next();
            for(int j = 0; j<m; j++){
                grid[i][j] = s.charAt(j);
                grid2[i][j] = s.charAt(j);
            }
        }
        int startn = in.nextInt()-1;
        int startm = in.nextInt()-1;
        int endn = in.nextInt()-1;
        int endm = in.nextInt()-1;
        boolean cracked = false;
        if(grid[endn][endm] == 'X') cracked = true;
        boolean path = false;
        boolean doit = true;
        Queue<Integer> x = new LinkedList<Integer>();
        Queue<Integer> y = new LinkedList<Integer>();
        x.add(startn);
        y.add(startm);
        //bfs
        while(!x.isEmpty() && !y.isEmpty()){
            startn = x.poll();
            startm = y.poll();
            if(startn==endn && startm==endm){
                path = true;
                break;
            }
            if(startn<0 || startm<0 || startn>=grid.length || startm>=grid[0].length){

            }
            else if(grid[startn][startm] == 'X' && !doit){
            }
            else{
                doit=false;
                grid[startn][startm] = 'X';
                x.add(startn+1);
                x.add(startn-1);
                x.add(startn);
                x.add(startn);
                y.add(startm);
                y.add(startm);
                y.add(startm+1);
                y.add(startm-1);
            }
        }
        if(path){
            int count = 0;
            int l = endn + 1;
            int r = endm;
            if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

            }
            else if(grid2[l][r] == '.'){
                ++count;
            }
            l = endn - 1;
            r = endm;
            if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

            }
            else if(grid2[l][r] == '.'){
                ++count;
            }
            l = endn;
            r = endm + 1;
            if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

            }
            else if(grid2[l][r] == '.'){
                ++count;
            }
            l = endn;
            r = endm - 1;
            if(l<0 || r<0 || l>=grid.length || r>=grid[0].length){

            }
            else if(grid2[l][r] == '.'){
                ++count;
            }
            if(cracked){
                if(count>=1){
                    out.print("YES");
                }
                else{
                    out.print("NO");
                }
            }
            else{
                if(count>=2){
                    out.print("YES");
                }
                else{
                    out.print("NO");
                }
            }
        }
        else{
            out.print("NO");
        }
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}