using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tes
{
class contest
{
static void Main(string[] args)
{
var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var position = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var map = new int[input[0], input[1]];
for(int i =0; i(position[0]-1, position[1]-1);
var goal = new Tuple(position[2]-1, position[3]-1);
var memo = new bool[input[0], input[1]];
var dx = new int[] { 0,1,0,-1, 0,2,0,-2};
var dy = new int[] { 1, 0, -1,0 , 2, 0,-2,0};
var posi = new Tuple(start.Item1, start.Item2);
memo[posi.Item1, posi.Item2] = true;
var queue = new Queue>();
queue.Enqueue(new Tuple(posi.Item1, posi.Item2));
while(queue.Count()>0)
{
Tuple current = queue.Dequeue();
for (int j = 0; j < 8; j++)
{
int x = current.Item1 + dx[j];
int y = current.Item2 + dy[j];
if (j / 4 == 0)
{
if (x >= 0 && x < input[0] && y >= 0 && y < input[1] && !memo[x, y])
{
if (map[x, y] - 1 == map[current.Item1, current.Item2]
|| map[x, y] + 1 == map[current.Item1, current.Item2]
|| map[x, y] == map[current.Item1, current.Item2] )
{
memo[x, y] = true;
queue.Enqueue(new Tuple(x,y));
}
}
}
else
{
if (x >= 0 && x < input[0] && y >= 0 && y < input[1] && !memo[x, y])
{
if (map[x, y] == map[current.Item1, current.Item2])
{
if (j == 4 && map[x, y - 1] < map[x, y])
{
memo[x, y] = true;
queue.Enqueue(new Tuple(x, y));
}
else if (j == 5 && map[x - 1, y] < map[x, y])
{
memo[x, y] = true;
queue.Enqueue(new Tuple(x, y));
}
else if (j == 6 && map[x, y + 1] < map[x, y])
{
memo[x, y] = true;
queue.Enqueue(new Tuple(x, y));
}
else if (j == 7 && map[x + 1, y] < map[x, y])
{
memo[x, y] = true;
queue.Enqueue(new Tuple(x, y));
}
}
}
}
}
}
if (memo[goal.Item1, goal.Item2]) Console.WriteLine("YES");
else Console.WriteLine("NO");
}
}
}