#include <iostream>
using namespace std;

int main() {
    int n;
    cin>>n;
    int x1,x2,y1,y2;
    cin>>x1>>y1;
    cin>>x2>>y2;
    if(y1>n||y2>n)                  //超限情况的考虑
    printf("NO");
    else if(x1==x2){
        if(y1==y2)                //同一起点
        cout<<"YES"; 
        else cout<<"NO";
    }
    else{
        if((x1>x2&&y1==n)||(x1<x2&&y2==n))  //其中一人起点及终点
        printf("NO");
        else if((y1-y2==1)||(y2-y1==1)&&((x1>x2&&y1!=n-1)||(x2>x1&&y2!=n-1)))      //&&前部分表示不同行俩人必须成对角,后部分终点处有特殊情况单独列出
        cout<<"YES";
        else
        cout<<"NO";
    }
    return 0;
}
// 64 位输出请用 printf("%lld")