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

public class C {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        try {
            in = new BufferedReader(new FileReader("rsq.in"));
            out = new PrintWriter(new File("rsq.out"));
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        }
        tok = new StringTokenizer("");
        new C().solve();
        out.flush();
        out.close();
    }

    String nextTok() throws IOException {
        if (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextTok());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextTok());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextTok());
    }
    int n;
    int m;
    int fi;
    int fj;
    boolean used[][];
    int ar[][];
    int cnt = 0;

    void tt(int ii, int jj) {
        used[ii][jj] = true;
        if (ii == fi && jj == fj) {
            used[ii][jj] = false;
            if (ar[ii][jj] == -1) {
                System.out.println("YES");
                System.exit(0);
            }
        }
        if (ar[ii][jj] == -1) return;
        ar[ii][jj] = -1;
        if (ii-1 >= 0 && !used[ii-1][jj]) tt(ii-1,jj);
        if (ii+1 < n && !used[ii+1][jj]) tt(ii+1,jj);
        if (jj+1 < m && !used[ii][jj+1]) tt(ii,jj+1);
        if (jj-1 >= 0 && !used[ii][jj-1]) tt(ii,jj-1);
        ar[ii][jj] = 0;

    }

    void solve() throws IOException {
        n = nextInt();
        m = nextInt();
        ar = new int[n][m];
        used = new boolean[n][m];
        for (int i = 0; i < n; i++) {
            String tmp = nextTok();
            for (int j = 0; j < m; j++) {
                if (tmp.charAt(j) == 'X') {
                    ar[i][j] = -1;
                } else ar[i][j] = 0;
            }
        }
        int si = nextInt();
        int sj = nextInt();
        fi = nextInt()-1;
        fj = nextInt()-1;
        ar[si-1][sj-1] = 0;
        tt(si - 1, sj - 1);
        System.out.println("NO");
        //System.out.println(cnt);

    }

}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }
}

class Point {
    int x,y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class TaskC {

    private Queue<Point> queue = new ArrayDeque<>();

    private int dx[] = { -1, 1, 0, 0};

    private int dy[] = { 0, 0, -1, 1};

    public void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        char tab[][] = new char[n][m];
        for(int i=0;i<n;i++) {
            tab[i] = in.next().toCharArray();
        }
        int x1 = in.nextInt() - 1;
        int y1 = in.nextInt() - 1;
        int x2 = in.nextInt() - 1;
        int y2 = in.nextInt() - 1;
        Point point = new Point(x1,y1);
        queue.add(point);
        while(!queue.isEmpty()) {
            point = queue.remove();
            x1 = point.x;
            y1 = point.y;
            if (x1 == x2 && y1 == y2) break;
            for (int i = 0; i < 4; i++) {
                if (x1 + dx[i] >= 0 && x1 + dx[i] < n && y1 + dy[i] >= 0 && y1 + dy[i] < m && tab[x1 + dx[i]][y1 + dy[i]] == '.') {
                    tab[x1 + dx[i]][y1 + dy[i]] = 'P';
                    queue.add(new Point(x1 + dx[i], y1 + dy[i]));
                }
            }
        }
        int count = 0;
        for(int i=0;i<4;i++) {
            if (x2 + dx[i] >= 0 && x2 + dx[i] < n && y2 + dy[i] >= 0 && y2 + dy[i] < m) {
                if(tab[x2][y2] == 'P' && tab[x2+dx[i]][y2+dy[i]] != 'X') {
                    count++;
                } else if(tab[x2][y2] == 'X' && tab[x2+dx[i]][y2+dy[i]] == 'P') {
                    count++;
                }
            }
        }
        out.printLine(((count >= 2 && tab[x2][y2] == 'P') || (count >=1 && tab[x2][y2] == 'X') ) ? "YES" : "NO");

    }

}

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 boolean hasNext() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if ( line == null ) {
                    return false;
                }
                tokenizer = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if ( i != 0 ) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }
    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }
    public void close() {
        writer.close();
    }
}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }
}

class Point {
    int x,y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class TaskC {

    private Queue<Point> queue = new ArrayDeque<>();

    private int dx[] = { -1, 1, 0, 0};

    private int dy[] = { 0, 0, -1, 1};

    public void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        char tab[][] = new char[n][m];
        for(int i=0;i<n;i++) {
            tab[i] = in.next().toCharArray();
        }
        int x1 = in.nextInt() - 1;
        int y1 = in.nextInt() - 1;
        int x2 = in.nextInt() - 1;
        int y2 = in.nextInt() - 1;
        Point point = new Point(x1,y1);
        queue.add(point);
        int x,y;
        while(!queue.isEmpty()) {
            point = queue.remove();
            x = point.x;
            y = point.y;
            for (int i = 0; i < 4; i++) {
                if (x + dx[i] >= 0 && x + dx[i] < n && y + dy[i] >= 0 && y + dy[i] < m && tab[x + dx[i]][y + dy[i]] == '.') {
                    tab[x + dx[i]][y + dy[i]] = 'P';
                    queue.add(new Point(x + dx[i], y + dy[i]));
                }
            }
        }
        int count = 0;
        for(int i=0;i<4;i++) {
            if (x2 + dx[i] >= 0 && x2 + dx[i] < n && y2 + dy[i] >= 0 && y2 + dy[i] < m) {
                if(tab[x2][y2] == 'P' && tab[x2+dx[i]][y2+dy[i]] != 'X') {
                    count++;
                } else if(tab[x2][y2] == 'X' && tab[x2+dx[i]][y2+dy[i]] == 'P') {
                    count++;
                } else if(tab[x2][y2] == 'X' && x2+dx[i] == x1 && y2+dy[i] == y1) {
                    count++;
                }
            }
        }

        out.printLine(((count >= 2 && tab[x2][y2] == 'P') || (count >=1 && tab[x2][y2] == 'X') ) ? "YES" : "NO");

    }

}

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 boolean hasNext() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if ( line == null ) {
                    return false;
                }
                tokenizer = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if ( i != 0 ) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }
    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }
    public void close() {
        writer.close();
    }
}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }
}

class Point {
    int x,y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class TaskC {

    private Queue<Point> queue = new ArrayDeque<>();

    private int dx[] = { -1, 1, 0, 0};

    private int dy[] = { 0, 0, -1, 1};

    public void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        char tab[][] = new char[n][m];
        for(int i=0;i<n;i++) {
            tab[i] = in.next().toCharArray();
        }
        int x1 = in.nextInt() - 1;
        int y1 = in.nextInt() - 1;
        int x2 = in.nextInt() - 1;
        int y2 = in.nextInt() - 1;
        Point point = new Point(x1,y1);
        queue.add(point);
        while(!queue.isEmpty()) {
            point = queue.remove();
            x1 = point.x;
            y1 = point.y;
            for (int i = 0; i < 4; i++) {
                if (x1 + dx[i] >= 0 && x1 + dx[i] < n && y1 + dy[i] >= 0 && y1 + dy[i] < m && tab[x1 + dx[i]][y1 + dy[i]] == '.') {
                    tab[x1 + dx[i]][y1 + dy[i]] = 'P';
                    queue.add(new Point(x1 + dx[i], y1 + dy[i]));
                }
            }
        }
        int count = 0;
        for(int i=0;i<4;i++) {
            if (x2 + dx[i] >= 0 && x2 + dx[i] < n && y2 + dy[i] >= 0 && y2 + dy[i] < m) {
                if(tab[x2][y2] == 'P' && tab[x2+dx[i]][y2+dy[i]] != 'X') {
                    count++;
                } else if(tab[x2][y2] == 'X' && tab[x2+dx[i]][y2+dy[i]] == 'P') {
                    count++;
                }
            }
        }
        out.printLine(((count >= 2 && tab[x2][y2] == 'P') || (count >=1 && tab[x2][y2] == 'X') ) ? "YES" : "NO");

    }

}

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 boolean hasNext() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if ( line == null ) {
                    return false;
                }
                tokenizer = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if ( i != 0 ) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }
    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }
    public void close() {
        writer.close();
    }
}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }
}

class Point {
    int x,y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class TaskC {

    private Queue<Point> queue = new ArrayDeque<>();

    private int dx[] = { -1, 1, 0, 0};

    private int dy[] = { 0, 0, -1, 1};

    public void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        char tab[][] = new char[n][m];
        for(int i=0;i<n;i++) {
            tab[i] = in.next().toCharArray();
        }
        int x1 = in.nextInt() - 1;
        int y1 = in.nextInt() - 1;
        int x2 = in.nextInt() - 1;
        int y2 = in.nextInt() - 1;

        Point point = new Point(x1,y1);
        queue.add(point);
        int x,y;
        while(!queue.isEmpty()) {
            point = queue.remove();
            x = point.x;
            y = point.y;
            for (int i = 0; i < 4; i++) {
                if (x + dx[i] >= 0 && x + dx[i] < n && y + dy[i] >= 0 && y + dy[i] < m && tab[x + dx[i]][y + dy[i]] == '.') {
                    tab[x + dx[i]][y + dy[i]] = 'P';
                    queue.add(new Point(x + dx[i], y + dy[i]));
                }
            }
        }
        int count = 0;
        boolean neighbours = false;
        for(int i=0;i<4;i++) {
            if (x2 + dx[i] >= 0 && x2 + dx[i] < n && y2 + dy[i] >= 0 && y2 + dy[i] < m) {
                if(x2 + dx[i] == x1 && y2 + dy[i] == y1) {
                    neighbours = true;
                }
                if(tab[x2][y2] == 'P' && tab[x2+dx[i]][y2+dy[i]] != 'X') {
                    count++;
                } else if(tab[x2][y2] == 'X' && tab[x2+dx[i]][y2+dy[i]] == 'P') {
                    count++;
                } else if(tab[x2][y2] == 'X' && x2+dx[i] == x1 && y2+dy[i] == y1) {
                    count++;
                }
            }
        }

        out.printLine(((count >= 2 && tab[x2][y2] == 'P') || (count >=1 && tab[x2][y2] == 'X') || (count>=1 && neighbours) ) ? "YES" : "NO");

    }

}

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 boolean hasNext() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if ( line == null ) {
                    return false;
                }
                tokenizer = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if ( i != 0 ) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }
    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }
    public void close() {
        writer.close();
    }
}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  // if destination is a '.'
  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && maze[x2][y2] == '.' && (!visited[x2][y2] || q.contains(new Point(x2, y2))))
                  return true;
              }
            }
            q.add(new Point(x, y));
            visited[x][y] = true;
          }
        }
      }
    }

    return false;
  }

  // if destination is an 'X'
  static Boolean BFS2(Point from, Point to) {

    for (int k = 0; k < 4; k++) {
      int x2 = from.x + dx[k];
      int y2 = from.y + dy[k];
      if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
        return true;
    }

    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && maze[x2][y2] == '.' && !visited[x2][y2])
                  return true;
              }
            }
            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  static Boolean BFS2(Point from, Point to) {

    for (int k = 0; k < 4; k++) {
      int x2 = from.x + dx[k];
      int y2 = from.y + dy[k];
      if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
        return true;
    }

    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && maze[x2][y2] == '.' && !visited[x2][y2])
                  return true;
              }
            }
            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  static Boolean BFS2(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  // if destination is a '.'
  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && maze[x2][y2] == '.' && (!visited[x2][y2] || q.contains(new Point(x2, y2))))
                  return true;
              }
            }
            q.add(new Point(x, y));
            visited[x][y] = true;
          }
        }
      }
    }

    return false;
  }

  // if destination is an 'X'
  static Boolean BFS2(Point from, Point to) {

    for (int k = 0; k < 4; k++) {
      int x2 = from.x + dx[k];
      int y2 = from.y + dy[k];
      if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
        return true;
    }

    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

    try {
      File file = new File("input.txt");
      Scanner sc = new Scanner(file);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

    }

    catch (FileNotFoundException e) {
      System.out.println(e);
    }

  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      visited[u.x][u.y] = true;
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && maze[x2][y2] == '.' && !visited[x2][y2])
                  return true;
              }
            }
            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  static Boolean BFS2(Point from, Point to) {

    for (int k = 0; k < 4; k++) {
      int x2 = from.x + dx[k];
      int y2 = from.y + dy[k];
      if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
        return true;
    }

    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if ((x2 >= 0 && x2 <= m && y2 >= 0 && y2 <= n) && x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class icecave {

  static Character[][] maze;
  static boolean[][] visited;
  static int m, n;

  static int dx[] = {0, 0, 1, -1};
  static int dy[] = {1, -1, 0, 0};

  static Boolean BFS(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;
            if (x == to.x && y == to.y) {
              for (int k = 0; k < 4; k++) {
                int x2 = x + dx[k];
                int y2 = y + dy[k];
                if (maze[x2][y2] == '.' && !visited[x2][y2])
                  return true;
              }
            }
            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  static Boolean BFS2(Point from, Point to) {
    Queue<Point> q = new LinkedList<Point>();
    q.add(from);
    int x, y;
    Point u;
    visited[from.x][from.y] = true;
    while (!q.isEmpty()) {
      u = q.remove();
      for (int i = 0; i < 4; i++) {
        x = u.x + dx[i];
        y = u.y + dy[i];
        if (x >= 0 && x <= m && y >= 0 && y <= n) {
          if (visited[x][y] == false && maze[x][y] == '.' ) {
            visited[x][y] = true;

            for (int k = 0; k < 4; k++) {
              int x2 = x + dx[k];
              int y2 = y + dy[k];
              if (x2 == to.x && y2 == to.y)
                return true;
            }

            q.add(new Point(x, y));
          }
        }
      }
    }

    return false;
  }

  public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);

      m = sc.nextInt();
      n = sc.nextInt();

      // create a visited array. use "boolean" instead of "Boolean" so I don't have to mark everyting as false
      visited = new boolean[m + 1][n + 1];

      maze = new Character[m + 1][n + 1];

      // build walls for maze to use indexes right
      for (int i = 0; i <= n; i++)
        maze[0][i] = 'X';
      for (int i = 0; i <= m; i++)
        maze[i][0] = 'X';

      // turn maze into array
      String temp;
      for (int i = 1; i <= m; i++) {
        temp = sc.next();
        for (int j = 0; j < n; j++) {
          maze[i][j + 1] = temp.charAt(j);
        }
      }

      Point from = new Point(sc.nextInt(), sc.nextInt());
      Point to = new Point(sc.nextInt(), sc.nextInt());

      // use BFS to get result
      Boolean result;
      if (maze[to.x][to.y] == '.')
        result = BFS(from, to);
      else
        result = BFS2(from, to);

      if (result)
        System.out.println("YES");
      else
        System.out.println("NO");

      sc.close();

  }

}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1)
            ok = true;
        out.println(reacheable && ok ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (check[r][c])
            return false;
        check[r][c] = true;
        if (r == r2 && c == c2)
            return true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1 || (cnt == 1 && r1 == r2 && c1 == c2))
            ok = true;
        out.println((reacheable && ok) ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (r == r2 && c == c2)
            return true;
        if (check[r][c] || grid[r][c] == 'X')
            return false;
        check[r][c] = true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        check[r][c] = false;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1 || (cnt == 1 && r1 == r2 && c1 == c2))
            ok = true;
        out.println(reacheable && ok ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (check[r][c])
            return false;
        check[r][c] = true;
        if (r == r2 && c == c2)
            return true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        check[r][c] = false;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        out.println(solve(r1, c1) ? "YES" : "NO");
    }

    private static boolean solve(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (grid[r][c] == 'X')
            return (r == r2 & c == c2);
        else {
            grid[r][c] = 'X';
            for (int i = 0; i < 4; i++)
                if (solve(r + rr[i], c + cc[i]))
                    return true;
            grid[r][c] = '.';
            return false;
        }
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1)
            ok = true;
        out.println(reacheable && ok ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (check[r][c])
            return false;
        check[r][c] = true;
        if (r == r2 && c == c2)
            return true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        check[r][c] = false;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1 || (cnt == 1 && r1 == r2 && c1 == c2))
            ok = true;
        out.println(reacheable);
        out.println(ok);
        out.println((reacheable && ok) ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (check[r][c] || grid[r][c] == 'X')
            return false;
        check[r][c] = true;
        if (r == r2 && c == c2)
            return true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        check[r][c] = false;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        out.println(dfs(r1, c1) ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (check[r][c])
            return false;
        check[r][c] = true;
        if (r == r2 && c == c2) {
            if (grid[r][c] == 'X')
                return true;
            for (int i = 0; i < 4; i++)
                if (r + rr[i] >= 0 && r + rr[i] < n && c + cc[i] >= 0
                        && c + cc[i] < m && grid[r + rr[i]][c + cc[i]] == '.'
                        && !check[r + rr[i]][c + cc[i]])
                    return true;
            return false;
        }
        else if (grid[r][c] == 'X')
            return false;
        else {
            for (int i = 0; i < 4; i++)
                if (dfs(r + rr[i], c + cc[i]))
                    return true;
            return false;
        }
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    public static void solution(BufferedReader reader, PrintWriter writer)
            throws IOException {
        In in = new In(reader);
        Out out = new Out(writer);
        n = in.nextInt();
        m = in.nextInt();
        grid = new char[n][m];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();
        r1 = in.nextInt() - 1;
        c1 = in.nextInt() - 1;
        r2 = in.nextInt() - 1;
        c2 = in.nextInt() - 1;
        grid[r1][c1] = '.';
        check = new boolean[n][m];
        boolean reacheable = dfs(r1, c1);
        boolean ok = grid[r2][c2] == 'X';
        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            int nr = r2 + rr[i], nc = c2 + cc[i];
            if (nr < 0 || nr >= n || nc < 0 || nc >= m)
                continue;
            if (grid[nr][nc] == '.')
                cnt++;
        }
        if (cnt > 1 || (cnt == 1 && r1 == r2 && c1 == c2))
            ok = true;
        out.println((reacheable && ok) ? "YES" : "NO");
    }

    private static boolean dfs(int r, int c) {
        if (r < 0 || r >= n || c < 0 || c >= m)
            return false;
        if (r == r2 && c == c2)
            return true;
        if (check[r][c] || grid[r][c] == 'X')
            return false;
        check[r][c] = true;
        for (int i = 0; i < 4; i++)
            if (dfs(r + rr[i], c + cc[i]))
                return true;
        return false;
    }

    private static int n, m;
    private static int r1, c1, r2, c2;
    private static char[][] grid;
    private static boolean[][] check;
    private static int[] rr = new int[] { 0, 0, 1, -1 };
    private static int[] cc = new int[] { 1, -1, 0, 0 };

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(System.out)));
        solution(reader, writer);
        writer.close();
    }

    protected static class In {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public In(BufferedReader reader) {
            this.reader = reader;
        }

        public String next() throws IOException {
            while (!tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(reader.readLine());
            return tokenizer.nextToken();
        }

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

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArray1(int n) throws IOException {
            int[] a = new int[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextInt();
            return a;
        }

        public int[] nextIntArraySorted(int n) throws IOException {
            int[] a = nextIntArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArray1(int n) throws IOException {
            long[] a = new long[n + 1];
            for (int i = 1; i <= n; i++)
                a[i] = nextLong();
            return a;
        }

        public long[] nextLongArraySorted(int n) throws IOException {
            long[] a = nextLongArray(n);
            Random r = new Random();
            for (int i = 0; i < n; i++) {
                int j = i + r.nextInt(n - i);
                long t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            Arrays.sort(a);
            return a;
        }
    }

    protected static class Out {
        private PrintWriter writer;
        private static boolean local = System
                .getProperty("ONLINE_JUDGE") == null;

        public Out(PrintWriter writer) {
            this.writer = writer;
        }

        public void print(char c) {
            writer.print(c);
        }

        public void print(int a) {
            writer.print(a);
        }

        public void printb(int a) {
            writer.print(a);
            writer.print(' ');
        }

        public void println(Object a) {
            writer.println(a);
        }

        public void println(Object[] os) {
            for (int i = 0; i < os.length; i++) {
                writer.print(os[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(int[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void println(long[] a) {
            for (int i = 0; i < a.length; i++) {
                writer.print(a[i]);
                writer.print(' ');
            }
            writer.println();
        }

        public void flush() {
            writer.flush();
        }

        public static void db(Object... objects) {
            if (local)
                System.out.println(Arrays.deepToString(objects));
        }
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package codeforces301;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
 *
 * @author Sourav Kumar Paul
 */
public class SolveC {

    public static class Graph {
    public int V;
    boolean flag;
    public ArrayList adj[];
    boolean marked[];
    public Graph(int V)
    {

        marked = new boolean[V];
        flag = false;
        this.V = V;
        adj = new ArrayList[V];
        for(int v = 0; v<V; v++)
        {
            adj[v] = new ArrayList();
        }

    }
    public int vertices()
    {
        return V;
    }
    public void addEdge(int v, int w)
    {
        adj[v].add(w);
        adj[w].add(v);
    }
    public ArrayList adj(int v)
    {
        return  adj[v];
    }

     public void show()
    {
        for(int i=0; i<V; i++)
        {
            for(Object v : adj(i))
                System.out.println(i+" -> "+(int)v);
        }
    }

        private boolean neigh(int beg, int end, int m) {

            if((beg % m == end % m) || Math.abs(beg%m - end%m)==1)
                return true;
            else
                return false;
        }

        private boolean reachable(int beg, int end) {

            dfs(beg,end);
            return flag;
        }

        private void dfs(int beg, int end) {

            marked[beg] = true;
            if(beg == end)
            {
                flag = true;
                return ;
            }
            for(Object i :adj(beg))
                if(!marked[(int)i])
                    dfs((int)i,end);
        }

}
    public static void main(String[] args) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line[] = reader.readLine().split(" ");
       // long start = System.currentTimeMillis();
        int n = Integer.parseInt(line[0]);
        int m = Integer.parseInt(line[1]);
        char arr[][] = new char[n][m];
        for(int i=0; i<n; i++)
        {
           String line1 = reader.readLine();
            for(int j=0; j<m; j++)
                arr[i][j] = line1.charAt(j);
        }
         line = reader.readLine().split(" ");
        int x1 = Integer.parseInt(line[0]) - 1;
        int y1 = Integer.parseInt(line[1]) - 1;
        int beg = (x1) * m + (y1);
        line = reader.readLine().split(" ");
        int x2 = Integer.parseInt(line[0]) - 1;
        int y2 =Integer.parseInt(line[1]) - 1;
        int end = (x2) * m + (y2);
        char ss = arr[x1][y1];
        char dd = arr[x2][y2];
        arr[x1][y1] = '.';
        arr[x2][y2] = '.';
        Graph graph = new Graph(n*m);
        for(int i=1; i<m; i++)
            if(arr[0][i] != 'X' && arr[0][i-1] != 'X')
                {

                    graph.addEdge(i, i-1);
                }
        for(int i=1; i<n; i++)
        {
            if(arr[i][0] != 'X' && arr[i-1][0] != 'X')
                graph.addEdge(i*m, (i-1)*m);
            for(int j=1; j<m; j++)
            {
                if(arr[i][j] != 'X' && arr[i-1][j] != 'X')
                {

                    graph.addEdge(i*m + j, (i-1)*m + j);
                }
                if(arr[i][j] != 'X' && arr[i][j-1] != 'X')
                {

                    graph.addEdge(i*m + j, (i)*m + j-1);
                }

            }
        }
        arr[x1][y1] = ss;
        arr[x2][y2] = dd;
       // graph.show();

       //System.out.println("beg"+beg+" end"+end);
        if(beg == end)
        {
            if(graph.adj[end].size() > 0)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(graph.neigh(beg, end, m))
        {
            if(arr[x2][y2] == 'X')
                System.out.println("YES");
            else if(graph.adj[end].size() > 0)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(graph.reachable(beg, end))
        {
            if(arr[x2][y2] == 'X' && graph.adj[end].size()>0)
                System.out.println("YES");
            else if(graph.adj[end].size() > 1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else
            System.out.println("NO");
        //System.out.println("\n\ntime: "+(System.currentTimeMillis() - start)/100F + "s");
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package codeforces301;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
 *
 * @author Sourav Kumar Paul
 */
public class SolveC {

    public static class Graph {
    public int V;
    boolean flag;
    public ArrayList adj[];
    boolean marked[];
    public Graph(int V)
    {

        marked = new boolean[V];
        flag = false;
        this.V = V;
        adj = new ArrayList[V];
        for(int v = 0; v<V; v++)
        {
            adj[v] = new ArrayList();
        }

    }
    public int vertices()
    {
        return V;
    }
    public void addEdge(int v, int w)
    {
        adj[v].add(w);
        adj[w].add(v);
    }
    public ArrayList adj(int v)
    {
        return  adj[v];
    }

     public void show()
    {
        for(int i=0; i<V; i++)
        {
            for(Object v : adj(i))
                System.out.println(i+" -> "+(int)v);
        }
    }

        private boolean neigh(int x1, int y1, int x2, int y2) {

            if(x1 == x2 && Math.abs(y2 - y1) ==1)
                return true;
            else if(y1 == y2 && Math.abs(x2 - x1 ) == 1)
                return true;
            else return false;
        }

        private boolean reachable(int beg, int end) {

            dfs(beg,end);
            return flag;
        }

        private void dfs(int beg, int end) {

            marked[beg] = true;
            if(beg == end)
            {
                flag = true;
                return ;
            }
            for(Object i :adj(beg))
                if(!marked[(int)i])
                    dfs((int)i,end);
        }

}
    public static void main(String[] args) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line[] = reader.readLine().split(" ");
       // long start = System.currentTimeMillis();
        int n = Integer.parseInt(line[0]);
        int m = Integer.parseInt(line[1]);
        char arr[][] = new char[n][m];
        for(int i=0; i<n; i++)
        {
           String line1 = reader.readLine();
            for(int j=0; j<m; j++)
                arr[i][j] = line1.charAt(j);
        }
         line = reader.readLine().split(" ");
        int x1 = Integer.parseInt(line[0]) - 1;
        int y1 = Integer.parseInt(line[1]) - 1;
        int beg = (x1) * m + (y1);
        line = reader.readLine().split(" ");
        int x2 = Integer.parseInt(line[0]) - 1;
        int y2 =Integer.parseInt(line[1]) - 1;
        int end = (x2) * m + (y2);
        char ss = arr[x1][y1];
        char dd = arr[x2][y2];
        arr[x1][y1] = '.';
        arr[x2][y2] = '.';
        Graph graph = new Graph(n*m);
        for(int i=1; i<m; i++)
            if(arr[0][i] != 'X' && arr[0][i-1] != 'X')
                {

                    graph.addEdge(i, i-1);
                }
        for(int i=1; i<n; i++)
        {
            if(arr[i][0] != 'X' && arr[i-1][0] != 'X')
                graph.addEdge(i*m, (i-1)*m);
            for(int j=1; j<m; j++)
            {
                if(arr[i][j] != 'X' && arr[i-1][j] != 'X')
                {

                    graph.addEdge(i*m + j, (i-1)*m + j);
                }
                if(arr[i][j] != 'X' && arr[i][j-1] != 'X')
                {

                    graph.addEdge(i*m + j, (i)*m + j-1);
                }

            }
        }
        arr[x1][y1] = ss;
        arr[x2][y2] = dd;
       // graph.show();

      // System.out.println("beg"+beg+" end"+end);
        if(beg == end)
        {
            if(graph.adj[end].size() > 0)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(graph.neigh(x1,y1,x2,y2))
        {
            if(arr[x2][y2] == 'X')
                System.out.println("YES");
            else if(graph.adj[end].size() > 1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(graph.reachable(beg, end))
        {
            if(arr[x2][y2] == 'X' && graph.adj[end].size()>0)
                System.out.println("YES");
            else if(graph.adj[end].size() > 1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else
            System.out.println("NO");
       // System.out.println("\n\ntime: "+(System.currentTimeMillis() - start)/100F + "s");
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package codeforces301;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
 *
 * @author Sourav Kumar Paul
 */
public class SolveC {

    public static class Graph {
    public int V;
    boolean flag;
    public ArrayList adj[];
    boolean marked[];
    public Graph(int V)
    {

        marked = new boolean[V];
        flag = false;
        this.V = V;
        adj = new ArrayList[V];
        for(int v = 0; v<V; v++)
        {
            adj[v] = new ArrayList();
        }

    }
    public int vertices()
    {
        return V;
    }
    public void addEdge(int v, int w)
    {
        adj[v].add(w);
        adj[w].add(v);
    }
    public ArrayList adj(int v)
    {
        return  adj[v];
    }

     public void show()
    {
        for(int i=0; i<V; i++)
        {
            for(Object v : adj(i))
                System.out.println(i+" -> "+(int)v);
        }
    }

        private boolean neigh(int beg, int end, int m) {

            if((beg % m == end % m) || Math.abs(beg%m - end%m)==1)
                return true;
            else
                return false;
        }

        private boolean reachable(int beg, int end) {

            dfs(beg,end);
            return flag;
        }

        private void dfs(int beg, int end) {

            marked[beg] = true;
            if(beg == end)
            {
                flag = true;
                return ;
            }
            for(Object i :adj(beg))
                if(!marked[(int)i])
                    dfs((int)i,end);
        }

}
    public static void main(String[] args) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line[] = reader.readLine().split(" ");
        long start = System.currentTimeMillis();
        int n = Integer.parseInt(line[0]);
        int m = Integer.parseInt(line[1]);
        char arr[][] = new char[n][m];
        for(int i=0; i<n; i++)
        {
           String line1 = reader.readLine();
            for(int j=0; j<m; j++)
                arr[i][j] = line1.charAt(j);
        }
         line = reader.readLine().split(" ");
        int x1 = Integer.parseInt(line[0]) - 1;
        int y1 = Integer.parseInt(line[1]) - 1;
        int beg = (x1) * m + (y1);
        line = reader.readLine().split(" ");
        int x2 = Integer.parseInt(line[0]) - 1;
        int y2 =Integer.parseInt(line[1]) - 1;
        int end = (x2) * m + (y2);
        char ss = arr[x1][y1];
        char dd = arr[x2][y2];
        arr[x1][y1] = '.';
        arr[x2][y2] = '.';
        Graph graph = new Graph(n*m);
        for(int i=1; i<m; i++)
            if(arr[0][i] != 'X' && arr[0][i-1] != 'X')
                {

                    graph.addEdge(i, i-1);
                }
        for(int i=1; i<n; i++)
        {
            if(arr[i][0] != 'X' && arr[i-1][0] != 'X')
                graph.addEdge(i*m, (i-1)*m);
            for(int j=1; j<m; j++)
            {
                if(arr[i][j] != 'X' && arr[i-1][j] != 'X')
                {

                    graph.addEdge(i*m + j, (i-1)*m + j);
                }
                if(arr[i][j] != 'X' && arr[i][j-1] != 'X')
                {

                    graph.addEdge(i*m + j, (i)*m + j-1);
                }

            }
        }
        arr[x1][y1] = ss;
        arr[x2][y2] = dd;
       // graph.show();

     //  System.out.println("beg"+beg+" end"+end);
        if(beg == end)
        {
            if(graph.adj[end].size() > 0)
                System.out.println("YES");
            else
                System.out.println("NO");
        }
        else if(graph.neigh(beg, end, m))
        {
            if(arr[x2][y2] == 'X')
                System.out.println("YES");
            else if(graph.adj[end].size() > 1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else if(graph.reachable(beg, end))
        {
            if(arr[x2][y2] == 'X' && graph.adj[end].size()>0)
                System.out.println("YES");
            else if(graph.adj[end].size() > 1)
                System.out.println("YES");
            else
                System.out.println("NO");

        }
        else
            System.out.println("NO");
       // System.out.println("\n\ntime: "+(System.currentTimeMillis() - start)/100F + "s");
    }

}