n = int(input())
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
# 计算无障碍物时到终点(2,n)的最短路径长度
def calc_shortest(x, y, n):
if x == 2 and y == n:
return 0 # 起点就是终点,路径长度为0
# 核心公式:向右走(n-y)步 + 第一行需额外1步向下到第二行
res = (n - y)
if x == 1:
res += 1
return res
# 步骤1:处理终点特殊情况(其中一个/两个在终点)
end1 = (x1 == 2 and y1 == n)
end2 = (x2 == 2 and y2 == n)
if end1 or end2:
print("YES" if end1 and end2 else "NO")
exit()
# 步骤2:计算基础最短路径长度
d1 = calc_shortest(x1, y1, n)
d2 = calc_shortest(x2, y2, n)
# 步骤3:基础情况 - 最短路径相等直接返回YES
if d1 == d2:
print("YES")
exit()
# 步骤4:计算差值与绕路空间判断
diff = abs(d1 - d2)
# 精准绕路空间:y <= n-2(至少有两列可移动,才能绕路增加长度)
def has_room(x, y, n):
return y <= n - 2
has_room1 = has_room(x1, y1, n)
has_room2 = has_room(x2, y2, n)
fixed1 = not has_room1 # d1固定,无法绕路增加长度
fixed2 = not has_room2 # d2固定,无法绕路增加长度
# 步骤5:核心约束判断
# 情况5.1:两人路径都固定 → 无法调整,返回NO
if fixed1 and fixed2:
print("NO")
# 情况5.2:仅Bing路径固定 → 需d2能绕路增加到d1(diff偶数且d2 <= d1)
elif fixed1:
if diff % 2 == 0 and d2 <= d1:
print("YES")
else:
print("NO")
# 情况5.3:仅Bong路径固定 → 需d1能绕路增加到d2(diff偶数且d1 <= d2)
elif fixed2:
if diff % 2 == 0 and d1 <= d2:
print("YES")
else:
print("NO")
# 情况5.4:两人都能绕路 → 补充列位置约束
else:
# 额外约束:若两人同属第一行,且右侧的人路径更短 → 无法仅让右侧的人绕路(障碍物会影响左侧的人)
same_row1 = (x1 == x2 == 1)
right_shorter = (y1 > y2 and d1 < d2) or (y2 > y1 and d2 < d1)
if same_row1 and right_shorter:
print("NO")
else:
print("YES" if diff % 2 == 0 else "NO")