#include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define forall(it,v) for(auto it=v.begin();it!=v.end();++it)
#define pb push_back
#define endl '\n'
#define PI 3.14159265358979323846
#define all(v) (v).begin(), (v).end()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(c) ((int)c.size())
#define ff first
#define ss second
#define EPS 1E-9
#define debug(s) cout<< #s <<" = "<< s <<endl
#define debugarr(arr, n) cout<< #arr << " = "; for(int i = 0; i < n; i++) {cout<<arr[i]<<" \n"[i == n - 1]; }
#define debugc(c) cout << #c << " = "; for(auto x : c) cout<<x<<" "; cout << endl
const int maxN = 1e6+5, MOD = 1e9+7, eps = 1e-7;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

ll n, a, b, m, k, q, s, d, x;

int main() {
    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    //ofstream cout("datos.txt");

    int qx, qy, kx, ky, tx, ty;

    cin >> n;

    cin >> qx >> qy >> kx >> ky >> tx >> ty;

    int kq, tq;

    if(qx > kx){
        if(qy > ky){
            kq = 1;
        }else{
            kq = 2;
        }
    }else{
        if(qy > ky){
            kq = 3;
        }else{
            kq = 4;
        }
    }

    if(qx > tx){
        if(qy > ty){
            tq = 1;
        }else{
            tq = 2;
        }
    }else{
        if(qy > ty){
            tq = 3;
        }else{
            tq = 4;
        }
    }

    if( tq != kq){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define INF 100000005
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define forall(it,v) for(auto it=v.begin();it!=v.end();++it)
#define pb push_back
#define endl '\n'
#define PI 3.14159265358979323846
#define all(v) (v).begin(), (v).end()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(c) ((int)c.size())
#define ff first
#define ss second
#define EPS 1E-9
#define debug(s) cout<< #s <<" = "<< s <<endl
#define debugarr(arr, n) cout<< #arr << " = "; for(int i = 0; i < n; i++) {cout<<arr[i]<<" \n"[i == n - 1]; }
#define debugc(c) cout << #c << " = "; for(auto x : c) cout<<x<<" "; cout << endl
const int maxN = 1e6+5, MOD = 1e9+7, eps = 1e-7;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

ll n, a, b, m, k, q, s, d, x;

bool attacked(int qx, int qy, int tx, int ty){
    return (tx - qx == ty - qy);
}

int main() {
    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    //ofstream cout("datos.txt");

    int qx, qy, kx, ky, tx, ty;

    cin >> n;

    cin >> qx >> qy >> kx >> ky >> tx >> ty;

    if(attacked(qx, qy, tx, ty)){
        cout << "NO" << endl;
        return 0;
    }

    if( (qx > kx && qx < tx) ||  (qy > ky && qy < ty)   ){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}


#include <iostream>

using namespace std;

bool check(int b,int c, int x) {
    if ((b>=x)&&(c>=x)||(b<=x)&&(c<=x)) {
        return true;
    } else {
        return false;
    }
}
int main () {
    int n;
    cin>>n;
    pair <int,int> a,b,c;
    cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
    if ((check(b.first,c.first,a.first)==true)&&(check(b.second,c.second,a.second)==true)) {
        for (int i=1;min(a.first-i,a.second-i)>0;++i) {
            pair <int,int> x;
            x.first=a.first-i;
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
            x.second=a.second+i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
        for (int i=1;min(a.first+i,a.second+i)<n;++i) {
            pair <int,int> x;
            x.first=a.first+i;
            x.second=a.second+i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <iostream>

using namespace std;

bool check(int b,int c, int x) {
    if ((b>=x)&&(c>=x)||(b<=x)&&(c<=x)) {
        return true;
    } else {
        return false;
    }
}
int main () {
    int n;
    cin>>n;
    pair <int,int> a,b,c;
    cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
    if ((check(b.first,c.first,a.first)==true)&&(check(b.second,c.second,a.second)==true)) {
        for (int i=1;min(a.first-i,a.second-i)>0;++i) {
            pair <int,int> x;
            x.first=a.first-i;
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
        for (int i=1;min(a.first+i,a.second+i)<n;++i) {
            pair <int,int> x;
            x.first=a.first-i;
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <iostream>

using namespace std;

bool check(int b,int c, int x) {
    if (((b>=x)&&(c>=x))||((b<=x)&&(c<=x))) {
        return true;
    } else {
        return false;
    }
}
int main () {
    int n;
    cin>>n;
    pair <int,int> a,b,c;
    cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
    if ((check(b.first,c.first,a.first)==true)&&(check(b.second,c.second,a.second)==true)) {
        for (int i=1;min(a.first-i,a.second-i)>=0;++i) {
            pair <int,int> x;
            x.first=a.first-i;
            x.second=a.second-i;
            if (((x.first==b.first)&&(check(b.second,c.second,x.second)==true))||((x.second==b.second)&&(check(b.first,c.first,x.first)==true))){
                cout<<"YES";
                return 0;
            }
            x.second=a.second+i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
        for (int i=1;min(a.first+i,a.second+i)<=n;++i) {
            pair <int,int> x;
            x.first=a.first+i;
            x.second=a.second+i;
            if (((x.first==b.first)&&(check(b.second,c.second,x.second)==true))||((x.second==b.second)&&(check(b.first,c.first,x.first)==true))){
                cout<<"YES";
                return 0;
            }
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include <iostream>

using namespace std;

bool check(int b,int c, int x) {
    if (((b>=x)&&(c>=x))||((b<=x)&&(c<=x))) {
        return true;
    } else {
        return false;
    }
}
int main () {
    int n;
    cin>>n;
    pair <int,int> a,b,c;
    cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
    if ((check(b.first,c.first,a.first)==true)&&(check(b.second,c.second,a.second)==true)) {
        for (int i=1;min(a.first-i,a.second-i)>=0;++i) {
            pair <int,int> x;
            x.first=a.first-i;
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
            x.second=a.second+i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
        for (int i=1;min(a.first+i,a.second+i)<=n;++i) {
            pair <int,int> x;
            x.first=a.first+i;
            x.second=a.second+i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
            x.second=a.second-i;
            if ((x.first==b.first)&&(check(b.second,c.second,x.second)==true)){
                cout<<"YES";
                return 0;
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include<bits/stdc++.h>
//#define int long long
using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int qx, qy;
    cin >> qx >> qy;

    int matrix[n+5][n+5];                                //was getting runtime error for matrix[n+1][n+1]
                                                        //always allocate some extra space if getting runtime error...
    memset(matrix, 0, sizeof matrix);

    int x = qx, y = qy;
    matrix[qx][qy] = -1;

    while(x >=1 && y >= 1){
        x--; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y <=n)
    {
        x++; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x >=1 && y <=n)
    {
        x--; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y >=1)
    {
        x++; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while(x >=1){
        x--;
        matrix[x][y] = -1;
    }

    while (x <=n)
    {
        x++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y <=n)
    {
       y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y >=1)
    {
         y--;
        matrix[x][y] = -1;
    }

    pair<int,int> src;
    cin >> src.first >> src.second;

    pair<int,int> dest;
    cin >> dest.first >> dest.second;

    queue<pair<int,int>> q;

    q.push(src);
    matrix[src.first][src.second] = -1;

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

    bool check = false;
    while(!q.empty()){
        pair<int,int> node = q.front();
        q.pop();
        if(node.first == dest.first && node.second == dest.second){
            check == true;
            cout << "YES\n";
            return 0;
        }
        for(int i=0; i<8; i++){
            int x,y;
            x = node.first + dx[i];
            if(x < 1 || x>n)
                continue;
            y = node.second + dy[i];
            if(y < 1 || y>n)
                continue;
            if(matrix[x][y] == -1)
                continue;
            if(matrix[x][y] == 0){
                matrix[x][y] = -1;
                q.push({x,y});
            }
        }
    }

    //if(check) cout << "YES\n";
    if(check == false) cout << "NO\n";
    return 0;

}


#include<bits/stdc++.h>
#define int long long
using namespace std;

int32_t main()
{
    int n;
    cin >> n;
    int qx, qy;
    cin >> qx >> qy;

    int matrix[n+1][n+1];

    memset(matrix, 0, sizeof matrix);

    int x = qx, y = qy;
    matrix[qx][qy] = -1;

    while(x >=1 && y >= 1){
        x--; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y <=n)
    {
        x++; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x >=1 && y <=n)
    {
        x--; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y >=1)
    {
        x++; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while(x >=1){
        x--;
        matrix[x][y] = -1;
    }

    while (x <=n)
    {
        x++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y <=n)
    {
       y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y >=1)
    {
         y--;
        matrix[x][y] = -1;
    }

    pair<int,int> src;
    cin >> src.first >> src.second;

    pair<int,int> dest;
    cin >> dest.first >> dest.second;

    queue<pair<int,int>> q;

    q.push(src);
    matrix[src.first][src.second] = -1;

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

    bool check = false;
    while(!q.empty()){
        pair<int,int> node = q.front();
        q.pop();
        if(node.first == dest.first && node.second == dest.second){
            check == true;
            cout << "YES\n";
            return 0;
        }
        for(int i=0; i<8; i++){
            int x,y;
            x = node.first + dx[i];
            if(x < 1 || x>n)
                continue;
            y = node.second + dy[i];
            if(y < 1 || y>n)
                continue;
            if(matrix[x][y] == -1)
                continue;
            if(matrix[x][y] == 0){
                matrix[x][y] = -1;
                q.push({x,y});
            }
        }
    }

    //if(check) cout << "YES\n";
    if(check == false) cout << "NO\n";
    return 0;

}


#include<bits/stdc++.h>
//#define int long long
using namespace std;

int32_t main()
{
    int n;
    cin >> n;
    int qx, qy;
    cin >> qx >> qy;

    int matrix[n+5][n+5];

    memset(matrix, 0, sizeof matrix);

    int x = qx, y = qy;
    matrix[qx][qy] = -1;

    while(x >=1 && y >= 1){
        x--; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y <=n)
    {
        x++; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x >=1 && y <=n)
    {
        x--; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y >=1)
    {
        x++; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while(x >=1){
        x--;
        matrix[x][y] = -1;
    }

    while (x <=n)
    {
        x++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y <=n)
    {
       y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y >=1)
    {
         y--;
        matrix[x][y] = -1;
    }

    pair<int,int> src;
    cin >> src.first >> src.second;

    pair<int,int> dest;
    cin >> dest.first >> dest.second;

    queue<pair<int,int>> q;

    q.push(src);
    matrix[src.first][src.second] = -1;

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

    bool check = false;
    while(!q.empty()){
        pair<int,int> node = q.front();
        q.pop();
        if(node.first == dest.first && node.second == dest.second){
            check == true;
            cout << "YES\n";
            return 0;
        }
        for(int i=0; i<8; i++){
            int x,y;
            x = node.first + dx[i];
            if(x < 1 || x>n)
                continue;
            y = node.second + dy[i];
            if(y < 1 || y>n)
                continue;
            if(matrix[x][y] == -1)
                continue;
            if(matrix[x][y] == 0){
                matrix[x][y] = -1;
                q.push({x,y});
            }
        }
    }

    //if(check) cout << "YES\n";
    if(check == false) cout << "NO\n";
    return 0;

}


#include<bits/stdc++.h>
#define int long long
using namespace std;

int32_t main()
{
    int n;
    cin >> n;
    int qx, qy;
    cin >> qx >> qy;

    int matrix[n+1][n+1];

    memset(matrix, 0, sizeof matrix);

    int x = qx, y = qy;
    matrix[qx][qy] = -1;

    while(x >=1 && y >= 1){
        x--; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y <=n)
    {
        x++; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x >=1 && y <=n)
    {
        x--; y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (x <=n && y >=1)
    {
        x++; y--;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while(x >=1){
        x--;
        matrix[x][y] = -1;
    }

    while (x <=n)
    {
        x++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y <=n)
    {
       y++;
        matrix[x][y] = -1;
    }

    x = qx, y = qy;
    while (y >=1)
    {
         y--;
        matrix[x][y] = -1;
    }

    /*for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++)
            cout << matrix[i][j] << " ";
        cout << "\n";
    }*/

    pair<int,int> src;
    cin >> src.first >> src.second;

    pair<int,int> dest;
    cin >> dest.first >> dest.second;

    queue<pair<int,int>> q;

    q.push(src);
    matrix[src.first][src.second] = -1;

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

    while(!q.empty()){
        pair<int,int> node = q.front();
        q.pop();
        if(node.first == dest.first && node.second == dest.second){
            cout << "YES\n";
            return 0;
        }
        for(int i=0; i<8; i++){
            int x,y;
            x = node.first + dx[i];
            if(x < 1 || x>n)
                continue;
            y = node.second + dy[i];
            if(y < 1 || y>n)
                continue;
            if(matrix[x][y] == -1)
                continue;
            if(matrix[x][y] == 0){
                matrix[x][y] = -1;
                q.push({x,y});
            }
        }
    }

    cout << "NO\n";
    return 0;

}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	int size,q_i,q_j,k_i1,k_j1,k_i2,k_j2;
	cin>>size>>q_i>>q_j>>k_i1>>k_j1>>k_i2>>k_j2;
	int a1=q_i-k_i1;
	int b1=q_j-k_j1;
	int a2=q_i-k_i2;
	int b2=q_i-k_j2;
	if(a1*a2>0 && b1*b2>0&&size>q_i&&size>q_j&&size>k_i1&&size>k_j1&&size>k_i2&&size>k_j2)cout<<"YES";
	else cout<<"NO";

	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	int size,q_i,q_j,k_i1,k_j1,k_i2,k_j2;
	cin>>size>>q_i>>q_j>>k_i1>>k_j1>>k_i2>>k_j2;
	int a1=q_i-k_i1;
	int b1=q_j-k_j1;
	int a2=q_i-k_i2;
	int b2=q_i-k_j2;
	if(a1*a2>0 && b1*b2>0&&size>=q_i&&size>=q_j&&size>=k_i1&&size>=k_j1&&size>=k_i2&&size>=k_j2)cout<<"YES";
	else cout<<"NO";

	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	int size,q_i,q_j,k_i1,k_j1,k_i2,k_j2;
	cin>>size>>q_i>>q_j>>k_i1>>k_j1>>k_i2>>k_j2;
	int a1=q_i-k_i1;
	int b1=q_j-k_j1;
	int a2=q_i-k_i2;
	int b2=q_i-k_j2;
	if(a1*a2>0 && b1*b2>0)cout<<"YES";
	else cout<<"NO";

	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	int size,q_i,q_j,k_i1,k_j1,k_i2,k_j2;
	cin>>size>>q_i>>q_j>>k_i1>>k_j1>>k_i2>>k_j2;
	int a1=q_i-k_i1;
	int b1=q_j-k_j1;
	int a2=q_i-k_i2;
	int b2=q_j-k_j2;
	if(a1*a2>0 && b1*b2>0&&size>=q_i&&size>=q_j&&size>=k_i1&&size>=k_j1&&size>=k_i2&&size>=k_j2)cout<<"YES";
	else cout<<"NO";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100
int k;

int dir[8][2]={{-1,0},{1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};
bool issafe(int board[N][N], int row, int col)
{
    int i, j;

    /* Check this row on left side */
    for (i = 0; i < k; i++)
        {board[row][i]=1;}
       for (i = 0; i < k; i++)
        {board[i][col]=1;}

    /* Check upper diagonal on left side */
    for (i=row, j=col; i>=0 && j>=0; i--, j--)
       {board[i][j]=1;}

    for (i=row, j=col; i>=0 && j<k; i--, j++)
        {board[i][j] =1;}

    /* Check lower diagonal on left side */
    for (i=row, j=col; j>=0 && i<k; i++, j--)
       {board[i][j]=1;}

    for (i=row, j=col; j<k && i<k; i++, j++)
        {board[i][j]=1; }

//cout<<row<<col<<"\n";

}
bool dfs(int board[N][N],int x,int y,int cx,int cy)
{
    if(x==cx&&y==cy)
    {
        //cout<<x<<y;
        return true;
    }

    for(int i=0;i<8;i++)
    {
        int kk=x+dir[i][0];
        int w=y+dir[i][1];
        if(kk<k&&w<k&&kk>=0&&w>=0)
       {

        //if(board[x][y]!=2)
        {
          if(!board[kk][w])
          {//cout<<y;
              //cout<<k<<" "<<w<<"\n";
             board[kk][w]=1;
             if(dfs(board,kk,w,cx,cy))
             {//cout<<x<<" "<<y<<"\n";
              return true;
             }
             board[kk][w]=0;
          }
        }
        }

    }
return false;
}
int main()
{
int board[N][N];

cin>>k;

ll ax,ay,bx,by,cx,cy;
cin>>ax;
cin>>ay;cin>>bx;cin>>by;cin>>cx;cin>>cy;
for(int i=0;i<k;i++)
{
    for(int j=0;j<k;j++)
    {

        board[i][j]=0;
    }
}
issafe(board,ax-1,ay-1);
/*for(int i=0;i<N;i++)
{
    for(int j=0;j<N;j++)
    {

        cout<<board[i][j]<<" ";
    }cout<<"\n";
}*/

if(dfs(board,bx-1,by-1,cx-1,cy-1))
{
    cout<<"YES";
}
else{cout<<"NO";}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1005
int board[N][N];
int k;

int dir[8][2]={{-1,0},{1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};
bool issafe( int row, int col)
{
    int i, j;

    /* Check this row on left side */
    for (i = 0; i < k; i++)
        {board[row][i]=1;}
       for (i = 0; i < k; i++)
        {board[i][col]=1;}

    /* Check upper diagonal on left side */
    for (i=row, j=col; i>=0 && j>=0; i--, j--)
       {board[i][j]=1;}

    for (i=row, j=col; i>=0 && j<k; i--, j++)
        {board[i][j] =1;}

    /* Check lower diagonal on left side */
    for (i=row, j=col; j>=0 && i<k; i++, j--)
       {board[i][j]=1;}

    for (i=row, j=col; j<k && i<k; i++, j++)
        {board[i][j]=1; }

//cout<<row<<col<<"\n";

}
bool dfs(int x,int y,int cx,int cy)
{
    if(x==cx&&y==cy)
    {
        //cout<<x<<y;
        return true;
    }

    for(int i=0;i<8;i++)
    {
        int kk=x+dir[i][0];
        int w=y+dir[i][1];
        if(kk<k&&w<k&&kk>=0&&w>=0)
       {

        //if(board[x][y]!=2)
        {
          if(!board[kk][w])
          {//cout<<y;
              //cout<<k<<" "<<w<<"\n";
             board[kk][w]=1;
             if(dfs(kk,w,cx,cy))
             {//cout<<x<<" "<<y<<"\n";
              return true;
             }
             //board[kk][w]=0;
          }
        }
        }

    }
return false;
}
int main()
{
//int board[N][N];

cin>>k;

ll ax,ay,bx,by,cx,cy;
cin>>ax;
cin>>ay;cin>>bx;cin>>by;cin>>cx;cin>>cy;
for(int i=0;i<k;i++)
{
    for(int j=0;j<k;j++)
    {

        board[i][j]=0;
    }
}
issafe(ax-1,ay-1);
/*for(int i=0;i<N;i++)
{
    for(int j=0;j<N;j++)
    {

        cout<<board[i][j]<<" ";
    }cout<<"\n";
}*/

if(dfs(bx-1,by-1,cx-1,cy-1))
{
    cout<<"YES";
}
else{cout<<"NO";}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 500
int k;

int dir[8][2]={{-1,0},{1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};
bool issafe(int board[N][N], int row, int col)
{
    int i, j;

    /* Check this row on left side */
    for (i = 0; i < k; i++)
        {board[row][i]=1;}
       for (i = 0; i < k; i++)
        {board[i][col]=1;}

    /* Check upper diagonal on left side */
    for (i=row, j=col; i>=0 && j>=0; i--, j--)
       {board[i][j]=1;}

    for (i=row, j=col; i>=0 && j<k; i--, j++)
        {board[i][j] =1;}

    /* Check lower diagonal on left side */
    for (i=row, j=col; j>=0 && i<k; i++, j--)
       {board[i][j]=1;}

    for (i=row, j=col; j<k && i<k; i++, j++)
        {board[i][j]=1; }

//cout<<row<<col<<"\n";

}
bool dfs(int board[N][N],int x,int y,int cx,int cy)
{
    if(x==cx&&y==cy)
    {
        //cout<<x<<y;
        return true;
    }

    for(int i=0;i<8;i++)
    {
        int kk=x+dir[i][0];
        int w=y+dir[i][1];
        if(kk<k&&w<k&&kk>=0&&w>=0)
       {

        //if(board[x][y]!=2)
        {
          if(!board[kk][w])
          {//cout<<y;
              //cout<<k<<" "<<w<<"\n";
             board[kk][w]=1;
             if(dfs(board,kk,w,cx,cy))
             {//cout<<x<<" "<<y<<"\n";
              return true;
             }
             board[kk][w]=0;
          }
        }
        }

    }
return false;
}
int main()
{
int board[N][N];

cin>>k;

ll ax,ay,bx,by,cx,cy;
cin>>ax;
cin>>ay;cin>>bx;cin>>by;cin>>cx;cin>>cy;
for(int i=0;i<k;i++)
{
    for(int j=0;j<k;j++)
    {

        board[i][j]=0;
    }
}
issafe(board,ax-1,ay-1);
/*for(int i=0;i<N;i++)
{
    for(int j=0;j<N;j++)
    {

        cout<<board[i][j]<<" ";
    }cout<<"\n";
}*/

if(dfs(board,bx-1,by-1,cx-1,cy-1))
{
    cout<<"YES";
}
else{cout<<"NO";}

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000
int k;

int dir[8][2]={{-1,0},{1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};
bool issafe(int board[N][N], int row, int col)
{
    int i, j;

    /* Check this row on left side */
    for (i = 0; i < k; i++)
        {board[row][i]=1;}
       for (i = 0; i < k; i++)
        {board[i][col]=1;}

    /* Check upper diagonal on left side */
    for (i=row, j=col; i>=0 && j>=0; i--, j--)
       {board[i][j]=1;}

    for (i=row, j=col; i>=0 && j<k; i--, j++)
        {board[i][j] =1;}

    /* Check lower diagonal on left side */
    for (i=row, j=col; j>=0 && i<k; i++, j--)
       {board[i][j]=1;}

    for (i=row, j=col; j<k && i<k; i++, j++)
        {board[i][j]=1; }

//cout<<row<<col<<"\n";

}
bool dfs(int board[N][N],int x,int y,int cx,int cy)
{
    if(x==cx&&y==cy)
    {
        //cout<<x<<y;
        return true;
    }

    for(int i=0;i<8;i++)
    {
        int kk=x+dir[i][0];
        int w=y+dir[i][1];
        if(kk<k&&w<k&&kk>=0&&w>=0)
       {

        //if(board[x][y]!=2)
        {
          if(!board[kk][w])
          {//cout<<y;
              //cout<<k<<" "<<w<<"\n";
             board[kk][w]=1;
             if(dfs(board,kk,w,cx,cy))
             {//cout<<x<<" "<<y<<"\n";
              return true;
             }
             board[kk][w]=0;
          }
        }
        }

    }
return false;
}
int main()
{
int board[N][N];

cin>>k;

ll ax,ay,bx,by,cx,cy;
cin>>ax;
cin>>ay;cin>>bx;cin>>by;cin>>cx;cin>>cy;
for(int i=0;i<k;i++)
{
    for(int j=0;j<k;j++)
    {

        board[i][j]=0;
    }
}
issafe(board,ax-1,ay-1);
/*for(int i=0;i<N;i++)
{
    for(int j=0;j<N;j++)
    {

        cout<<board[i][j]<<" ";
    }cout<<"\n";
}*/

if(dfs(board,bx-1,by-1,cx-1,cy-1))
{
    cout<<"YES";
}
else{cout<<"NO";}

}


#include <bits/stdc++.h>
using namespace std;

pair<int, int> moves[] = {
        make_pair(0, 1),
        make_pair(0, -1),
        make_pair(1, 0),
        make_pair(-1, 0),
        make_pair(1, 1),
        make_pair(-1, -1),
        make_pair(-1, 1),
        make_pair(1, -1),
};

bool isIn(pair <int, int> f) {
    return (f.first <= 8 && f.first >= 1 && f.second <= 8 && f.second >= 1);
}

map <pair<int, int>, int> vis;

int main() {
    int n;
    int ax,ay, bx,by,cx,cy;
    cin >> n >> ax >> ay >> bx >> by >> cx >> cy;
    queue <pair<int, int>> q;
    q.push(make_pair(bx, by));
    vis[make_pair(bx, by)]++;
    while (!q.empty()) {
        pair<int, int> f = q.front();
        q.pop();
        for (auto i : moves) {
            pair <int, int> ne(i.first + f.first, i.second + f.second);
            //cout << "cur: " << ne.first << ' ' << ne.second << endl;
            if (isIn(ne)) {
                if (ne.first == ax || ne.second == ay) {
                    continue;
                } else {
                    if (ne.first == cx && ne.second == cy) {
                        cout << "YES\n";
                        return 0;
                    } else {
                        if (vis[ne] == 0)
                        {
                            q.push(ne);
                            vis[ne]++;
                        }
                    }
                    //q.push(ne);
                }

            }

        }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1e9;
int n, ax, ay, bx, by, cx, cy;

int main() {
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    int bdx = bx - ax,
        bdy = by - ay,
        cdx = cx - ax,
        cdy = cy - ay;
    if (bdx > 0 && bdy > 0 && cdx > 0 && cdy > 0) {
        cout << "YES\n";
    }
    if (bdx < 0 && bdy < 0 && cdx < 0 && cdy < 0) {
        cout << "YES\n";
    }
    if (bdx > 0 && bdy < 0 && cdx > 0 && cdy < 0) {
        cout << "YES\n";
    }
    if (bdx < 0 && bdy > 0 && cdx < 0 && cdy > 0) {
        cout << "YES\n";
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

pair<int, int> moves[] = {
        make_pair(0, 1),
        make_pair(0, -1),
        make_pair(1, 0),
        make_pair(-1, 0),
        make_pair(1, 1),
        make_pair(-1, -1),
        make_pair(-1, 1),
        make_pair(1, -1),
};

int n;

bool isIn(pair <int, int> f) {
    return (f.first <= n && f.first >= 1 && f.second <= n && f.second >= 1);
}

map <pair<int, int>, int> vis;

int main() {
    int ax,ay, bx,by,cx,cy;
    cin >> n >> ax >> ay >> bx >> by >> cx >> cy;
    queue <pair<int, int>> q;
    q.push(make_pair(bx, by));
    vis[make_pair(bx, by)]++;
    while (!q.empty()) {
        pair<int, int> f = q.front();
        q.pop();
        for (auto i : moves) {
            pair <int, int> ne(i.first + f.first, i.second + f.second);
            //cout << "cur: " << ne.first << ' ' << ne.second << endl;
            if (isIn(ne)) {
                if (ne.first == ax || ne.second == ay) {
                    continue;
                } else {
                    if (ne.first == cx && ne.second == cy) {
                        cout << "YES\n";
                        return 0;
                    } else {
                        if (vis[ne] == 0)
                        {
                            q.push(ne);
                            vis[ne]++;
                        }
                    }
                    //q.push(ne);
                }

            }

        }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1e9;
int n, ax, ay, bx, by, cx, cy;

int main() {
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    if (cx > ax && cy > ay && bx > ax && by > ay) {
        cout << "YES\n";
        return 0;
    }
    if (cx < ax && cy < ay && bx < ax && by < ay) {
        cout << "YES\n";
        return 0;
    }
    if (cx > ax && cy < ay && bx < ax && by > cy) {
        cout << "YES\n";
        return 0;
    }
    if (cx < ax && cy > ay && bx > ax && by < cy) {
        cout << "YES\n";
        return 0;
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1e9;
int n, ax, ay, bx, by, cx, cy;

int main() {
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    int bdx = bx - ax,
        bdy = by - ay,
        cdx = cx - ax,
        cdy = cy - ay;
    if (bdx > 0 && bdy > 0 && cdx > 0 && cdy > 0) {
        cout << "YES\n";
        return 0;
    }
    if (bdx < 0 && bdy < 0 && cdx < 0 && cdy < 0) {
        cout << "YES\n";
        return 0;
    }
    if (bdx > 0 && bdy < 0 && cdx > 0 && cdy < 0) {
        cout << "YES\n";
        return 0;
    }
    if (bdx < 0 && bdy > 0 && cdx < 0 && cdy > 0) {
        cout << "YES\n";
        return 0;
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 1e9;
int n, ax, ay, bx, by, cx, cy;

int main() {
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    if (cx > ax && cy > ay && bx > ax && by > ay) {
        cout << "YES\n";
        return 0;
    }
    if (cx < ax && cy < ay && bx < ax && by < ay) {
        cout << "YES\n";
        return 0;
    }
    if (cx > ax && cy < ay && bx > ax && by < cy) {
        cout << "YES\n";
        return 0;
    }
    if (cx < ax && cy > ay && bx < ax && by > cy) {
        cout << "YES\n";
        return 0;
    }
    cout << "NO\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
bool visited[1001][1001];
bool isvalid(int x,int y,int ax,int ay,int n,int m)
{
    if(x>=0&&y>=0&&x<n&&y<m)
    {
        if(x!=ax&&y!=ay&&x-ax!=y-ay&&visited[x][y]==false)
            return true;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;
    int ax,ay,bx,by,cx,cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    if(ax-bx<0&&ax-cx<0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by<0&&ay-cy<0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    if(ax-by>0&&ax-cx>0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by<0&&ay-cy<0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    cout<<"NO";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
bool visited[1001][1001];
bool isvalid(int x,int y,int ax,int ay,int n,int m)
{
    if(x>=0&&y>=0&&x<n&&y<m)
    {
        if(x!=ax&&y!=ay&&x-ax!=y-ay&&visited[x][y]==false)
            return true;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;
    int ax,ay,bx,by,cx,cy;
    memset(visited,false,sizeof(visited));
    queue<pair<int,int> >q;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    q.push({bx,by});
    int arr1[8]={-1,0,1,0,-1,-1,1,1};
    int arr2[8]={0,-1,0,1,1,-1,1,-1};
    visited[bx][by]=true;
    while(!q.empty())
    {
        pair<int,int>temp=q.front();
        q.pop();
        int x=temp.first;
        int y=temp.second;
        if(temp.first==cx&&temp.second==cy)
        {
            cout<<"YES";
            return 0;
        }
        else
        {
            for(int i=0;i<8;i++)
            {
                if(isvalid(arr1[i]+x,arr2[i]+y,ax,ay,n,n))
                {
                    q.push({arr1[i]+x,arr2[i]+y});
                    visited[arr1[i]+x][arr2[i]+y]=true;
                }
            }
        }
    }
    cout<<"NO";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
bool visited[1001][1001];
bool isvalid(int x,int y,int ax,int ay,int n,int m)
{
    if(x>=0&&y>=0&&x<n&&y<m)
    {
        if(x!=ax&&y!=ay&&x-ax!=y-ay&&visited[x][y]==false)
            return true;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;
    int ax,ay,bx,by,cx,cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    if(ax-bx<0&&ax-cx<0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    if(ax-by>0&&ax-cx>0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    cout<<"NO";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
bool visited[1001][1001];
bool isvalid(int x,int y,int ax,int ay,int n,int m)
{
    if(x>=0&&y>=0&&x<n&&y<m)
    {
        if(x!=ax&&y!=ay&&x-ax!=y-ay&&visited[x][y]==false)
            return true;
    }
    return false;
}
int main()
{
    int n;
    cin >> n;
    int ax,ay,bx,by,cx,cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    if(ax-bx<0&&ax-cx<0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by<0&&ay-cy<0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    if(ax-bx>0&&ax-cx>0)
    {
        if(ay-by>0&&ay-cy>0)
        {
            cout<<"YES";
            return 0;
        }
        if(ay-by<0&&ay-cy<0)
        {
            cout<<"YES";
            return 0;
        }
        cout<<"NO";
        return 0;
    }
    cout<<"NO";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
const int MAXN = 1e6 + 7;
const int INF = 1e9 + 7;

bool check[1100][1100], vis[1100][1100];
int movex[9] = {-1,-1,+1,+1,0,0,+1,-1};
int movey[9] = {+1,-1,+1,-1,+1,-1,0,0};

int main(){
    int n;
    cin >> n;
    int ax, ay, bx, by, cx, cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for(int i = 0;i < n;i++){
        check[ax][i] = true;
        check[i][ay] = true;
    }
	for(int i = ax,j = ay;i >= 0 && j >= 0;i--,j--) check[i][j] = true;
	for(int i = ax,j = ay;i >= 0 && j < n;i--,j++) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j >= 0;i++,j--) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j < n;i++,j++) check[i][j] = true;
    queue<pii> q;
    q.push(pii(bx,by));
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        if(x == cx && y == cy){
            cout << "YES\n";
            return 0;
        }
        if(vis[x][y]) continue;
        vis[x][y] = true;
        for(int i = 0;i < 8;i++){
            int dx = x + movex[i];
            int dy = y + movey[i];
            if(dx >= 0 && dx < n && dy >= 0 && dy < n && !check[dx][dy] && !vis[dx][dy]){
                q.push(pii(dx,dy));
            }
        }
    }
    cout << "NO\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
const int MAXN = 1e6 + 7;
const int INF = 1e9 + 7;

bool check[1100][1100], vis[1100][1100];
int movex[9] = {-1,-1,+1,+1,0,0,+1,-1};
int movey[9] = {+1,-1,+1,-1,+1,-1,0,0};

int main(){
	int n;
	cin >> n;
	int ax, ay, bx, by, cx, cy;
	cin >> ax >> ay >> bx >> by >> cx >> cy;
	for(int i = 0;i < n;i++){
		check[ax][i] = true;
		check[i][ay] = true;
	}
	for(int i = 0;i < n;i++){
		check[max(ax-i,0)][max(ay-i,0)] = true;
		check[min(ax+i,n)][max(ay-i,0)] = true;
		check[max(ax-i,0)][min(ay+i,n)] = true;
		check[min(ax+i,0)][min(ay+i,n)] = true;
	}
	queue<pii> q;
	q.push(pii(bx,by));
	while(!q.empty()){
		int x = q.front().first;
		int y = q.front().second;
		q.pop();
		if(x == cx && y == cy){
			cout << "YES\n";
			return 0;
		}
		if(vis[x][y]) continue;
		vis[x][y] = true;
		for(int i = 0;i < 8;i++){
			int dx = x + movex[i];
			int dy = y + movey[i];
			if(dx >= 0 && dx < n && dy >= 0 && dy < n && !check[dx][dy] && !vis[dx][dy]){
				q.push(pii(dx,dy));
			}
		}
	}
	cout << "NO\n";
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
const int MAXN = 1e6 + 7;
const int INF = 1e9 + 7;

bool check[1100][1100], vis[1100][1100];
int movex[9] = {-1,-1,+1,+1,0,0,+1,-1};
int movey[9] = {+1,-1,+1,-1,+1,-1,0,0};

int main(){
    int n;
    cin >> n;
    int ax, ay, bx, by, cx, cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for(int i = 0;i < n;i++){
        check[ax][i] = true;
        check[i][ay] = true;
    }
	for(int i = ax,j = ay;i >= 0 && j >= 0;i--,j--) check[i][j] = true;
	for(int i = ax,j = ay;i >= 0 && j < n;i--,j++) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j >= 0;i++,j--) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j < n;i++,j++) check[i][j] = true;
    queue<pii> q;
    q.push(pii(bx,by));
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        if(check[x][y]) continue;
        if(x == cx && y == cy){
            cout << "YES\n";
            return 0;
        }
        if(vis[x][y]) continue;
        vis[x][y] = true;
        for(int i = 0;i < 8;i++){
            int dx = x + movex[i];
            int dy = y + movey[i];
            if(dx >= 0 && dx < n && dy >= 0 && dy < n && !check[dx][dy] && !vis[dx][dy]){
                q.push(pii(dx,dy));
            }
        }
    }
    cout << "NO\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
const int MAXN = 1e6 + 7;
const int INF = 1e9 + 7;

bool check[1100][1100], vis[1100][1100];
int movex[9] = {-1,-1,+1,+1,0,0,+1,-1};
int movey[9] = {+1,-1,+1,-1,+1,-1,0,0};

int main(){
    int n;
    cin >> n;
    int ax, ay, bx, by, cx, cy;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    ax--;ay--;bx--;by--;cx--;cy--;
    for(int i = 0;i < n;i++){
        check[ax][i] = true;
        check[i][ay] = true;
    }
	for(int i = ax,j = ay;i >= 0 && j >= 0;i--,j--) check[i][j] = true;
	for(int i = ax,j = ay;i >= 0 && j < n;i--,j++) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j >= 0;i++,j--) check[i][j] = true;
	for(int i = ax,j = ay;i < n && j < n;i++,j++) check[i][j] = true;
    queue<pii> q;
    q.push(pii(bx,by));
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        if(check[x][y]) continue;
        if(x == cx && y == cy){
            cout << "YES\n";
            return 0;
        }
        if(vis[x][y]) continue;
        vis[x][y] = true;
        for(int i = 0;i < 8;i++){
            int dx = x + movex[i];
            int dy = y + movey[i];
            if(dx >= 0 && dx < n && dy >= 0 && dy < n && !check[dx][dy] && !vis[dx][dy]){
                q.push(pii(dx,dy));
            }
        }
    }
    cout << "NO\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int
#define hell (ll)(1e9+7)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sep(i,a,b) for(int i=a-1;i>=b;i--)

ll cycle(ll s,vector <ll> adj[],vector <bool> &visited)
{
    visited[s]=true;
    rep(i,0,adj[s].size())
    {
        if(visited[adj[s][i]])
            return adj[s][i];
        return cycle(adj[s][i],adj,visited);
    }
}

void solve()
{
    ll n,ax,ay,bx,by,cx,cy,x1,y1,x,y;
    cin>>n;
    cin>>bx>>by>>ax>>ay>>cx>>cy;
    vector < vector <bool> > v(n+1,vector <bool> (n+1,false));
    ll xdir[]={1,-1,1,1,-1,-1,0,0};
    ll ydir[]={0,0,1,-1,1,-1,1,-1};
    queue < pair <ll,ll> > q;
    q.push({ax,ay});
    v[ax][ay]=true;
    while(!q.empty())
    {
        auto p=q.front();
        q.pop();
        x1=p.first;
        y1=p.second;
        rep(i,0,8)
        {
            x=x1+xdir[i];
            y=y1+ydir[i];
            if(x>n+1||y>n+1||x<=0||y<=0||(x==bx&&y==by)||v[x][y])
                continue;
            if(x==bx||y==by||abs(x-bx)==abs(y-by))
                continue;
            else
            {
                v[x][y]=true;
                q.push({x,y});
    //            cout<<x<<" "<<y<<"\n";
            }
        }
    }
    if(v[cx][cy])
        cout<<"YES";
    else
        cout<<"NO";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int
#define hell (ll)(1e9+7)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sep(i,a,b) for(int i=a-1;i>=b;i--)

ll cycle(ll s,vector <ll> adj[],vector <bool> &visited)
{
    visited[s]=true;
    rep(i,0,adj[s].size())
    {
        if(visited[adj[s][i]])
            return adj[s][i];
        return cycle(adj[s][i],adj,visited);
    }
}

void solve()
{
    ll n,ax,ay,bx,by,cx,cy,x1,y1,x,y;
    cin>>n;
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    vector < vector <int> > v(n+1,vector <int> (n+1,-1));
    ll xdir[]={1,-1,1,1,-1,-1,0,0};
    ll ydir[]={0,0,1,-1,1,-1,1,-1};
    queue < pair <ll,ll> > q;
    q.push({bx,by});
    v[bx][by]=1;
    while(!q.empty())
    {
        auto p=q.front();
        q.pop();
        x1=p.first;
        y1=p.second;
        rep(i,0,8)
        {
            x=x1+xdir[i];
            y=y1+ydir[i];
            if(x>=n||y>=n||x<=0||y<=0||x==ax||y==ay||v[x][y]==1||abs(x-ax)==abs(y-ay))
                continue;
            v[x][y]=1;
            q.push({x,y});
    //            cout<<x<<" "<<y<<"\n";
        }
    }
    if(v[cx][cy]==1)
        cout<<"YES";
    else
        cout<<"NO";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int
#define hell (ll)(1e9+7)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sep(i,a,b) for(int i=a-1;i>=b;i--)

ll cycle(ll s,vector <ll> adj[],vector <bool> &visited)
{
    visited[s]=true;
    rep(i,0,adj[s].size())
    {
        if(visited[adj[s][i]])
            return adj[s][i];
        return cycle(adj[s][i],adj,visited);
    }
}

void solve()
{
    ll n,ax,ay,bx,by,cx,cy,x1,y1,x,y;
    cin>>n;
    cin>>bx>>by>>ax>>ay>>cx>>cy;
    vector < vector <int> > v(n+1,vector <int> (n+1,-1));
    ll xdir[]={1,-1,1,1,-1,-1,0,0};
    ll ydir[]={0,0,1,-1,1,-1,1,-1};
    queue < pair <ll,ll> > q;
    q.push({ax,ay});
    v[ax][ay]=1;
    while(!q.empty())
    {
        auto p=q.front();
        q.pop();
        x1=p.first;
        y1=p.second;
        rep(i,0,8)
        {
            x=x1+xdir[i];
            y=y1+ydir[i];
            if(x>n+1||y>n+1||x<=0||y<=0||x==bx||y==by||v[x][y]==1||abs(x-bx)==abs(y-by))
                continue;
            v[x][y]=1;
            q.push({x,y});
    //            cout<<x<<" "<<y<<"\n";
        }
    }
    if(v[cx][cy]==1)
        cout<<"YES";
    else
        cout<<"NO";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long int
#define hell (ll)(1e9+7)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define sep(i,a,b) for(int i=a-1;i>=b;i--)

ll cycle(ll s,vector <ll> adj[],vector <bool> &visited)
{
    visited[s]=true;
    rep(i,0,adj[s].size())
    {
        if(visited[adj[s][i]])
            return adj[s][i];
        return cycle(adj[s][i],adj,visited);
    }
}

void solve()
{
    ll n,ax,ay,bx,by,cx,cy,x1,y1,x,y;
    cin>>n;
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    vector < vector <int> > v(n+1,vector <int> (n+1,-1));
    ll xdir[]={1,-1,1,1,-1,-1,0,0};
    ll ydir[]={0,0,1,-1,1,-1,1,-1};
    queue < pair <ll,ll> > q;
    q.push({bx,by});
    v[bx][by]=1;
    while(!q.empty())
    {
        auto p=q.front();
        q.pop();
        x1=p.first;
        y1=p.second;
        rep(i,0,8)
        {
            x=x1+xdir[i];
            y=y1+ydir[i];
            if(x>n||y>n||x<=0||y<=0||x==ax||y==ay||v[x][y]==1||abs(x-ax)==abs(y-ay))
                continue;
            v[x][y]=1;
            q.push({x,y});
    //            cout<<x<<" "<<y<<"\n";
        }
    }
    if(v[cx][cy]==1)
        cout<<"YES";
    else
        cout<<"NO";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int n;

void dfs(int u, int v)
{
    visit[u][v] = 1;
    for (int i = 0; i < 8; i++) {
        int tx = u + dx[i];
        int ty = v = dy[i];
        if ((tx>=1)&&(tx<=n)&&(ty>=1)&&(ty<=n)&&(visit[tx][ty]==0)&&(allow[tx][ty]==0)) {
            dfs(tx, ty);
        }
    }
    visit[u][v] = 2;
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;

    for (i = 1; i <= n; i++) {
        allow[i][ax] = 1;
    }
    for (i = 1; i <= n; i++) {
        allow[ay][i] = 1;
    }

    dfs(bx, by);
    if (visit[cx][cy] == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int n;

void dfs(int u, int v)
{
    visit[u][v] = 1;
    for (int i = 0; i < 8; i++) {
        int tx = u + dx[i];
        int ty = v = dy[i];
        if ((tx>=1)&&(tx<=n)&&(ty>=1)&&(ty<=n)&&(visit[tx][ty]==0)&&(allow[tx][ty]==0)) {
            dfs(tx, ty);
        }
    }
    visit[u][v] = 2;
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i, j;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;

    for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (i == ax || j == ay || i + j == ax + ay || i - j == ax - ay) {
				allow[i][j] = 1;
			}
		}
	}

    dfs(bx, by);
    if (visit[cx][cy] == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define pii pair<int, int>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int n;

void dfs(int u, int v)
{
    if  ((u<1)&&(u>n)&&(v<1)&&(v>n)&&(visit[u][v]==1)&&(allow[u][v]==1))
        return;
    visit[u][v] = 1;
    for (int i = 0; i < 8; i++) {
        int tx = u + dx[i];
        int ty = v + dy[i];
        dfs(tx, ty);
    }
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i, j;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (i == ax || j == ay || i + j == ax + ay || i - j == ax - ay) {
				allow[i][j] = 1;
			}
		}
	}

    dfs(bx, by);
    if (visit[cx][cy] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define pii pair<int, int>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int n;

void bfs(int u, int v)
{
    queue <pii> q;
    visit[u][v] = 1;
    q.push(pii(u, v));
    while (!q.empty()) {
        pii top = q.front();
        q.pop();
        for (int i = 0; i < 8; i++) {
            int tx = top.first + dx[i];
            int ty = top.second + dy[i];
            if ((tx>=1)&&(tx<=n)&&(ty>=1)&&(ty<=n)&&(visit[tx][ty]==0)&&(allow[tx][ty]==0)) {
                visit[tx][ty] = 1;
                q.push(pii(tx, ty));
            }
        }
    }
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i, j;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (i == ax || j == ay || i + j == ax + ay || i - j == ax - ay) {
				allow[i][j] = 1;
			}
		}
	}

    bfs(bx, by);
    if (visit[cx][cy] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, xq, yq, xk, yk, tx, ty;
    cin >> n;
    cin >> xq >> yq;
    cin >> xk >> yk;
    cin >> tx >> ty;
    if (yq > yk) {
        if (ty >= yq) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
    else {
        if (ty <= yq) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define pii pair<int, int>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int n;

void bfs(int u, int v)
{
    queue <pii> q;
    visit[u][v] = 1;
    q.push(pii(u, v));
    while (!q.empty()) {
        pii top = q.front();
        q.pop();
        for (int i = 0; i < 8; i++) {
            int tx = top.first + dx[i];
            int ty = top.second + dy[i];
            if ((tx>=1)&&(tx<=n)&&(ty>=1)&&(ty<=n)&&(visit[tx][ty]==0)&&(allow[tx][ty]==0)) {
                visit[tx][ty] = 1;
                q.push(pii(tx, ty));
            }
        }
    }
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for (i = 1; i <= n; i++) {
        allow[i][ax] = 1;
    }
    for (i = 1; i <= n; i++) {
        allow[ay][i] = 1;
    }

    bfs(bx, by);
    if (visit[cx][cy] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define pii pair<int, int>

using namespace std;

int allow[1002][1002];
int visit[1002][1002];
const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int n;

void dfs(int u, int v)
{
    stack <pii> st;
    visit[u][v] = 1;
    st.push(pii(u, v));
    while (!st.empty()) {
        pii top = st.top();
        st.pop();
        for (int i = 0; i < 8; i++) {
            int tx = top.first + dx[i];
            int ty = top.second + dy[i];
            if ((tx>=1)&&(tx<=n)&&(ty>=1)&&(ty<=n)&&(visit[tx][ty]==0)&&(allow[tx][ty]==0)) {
                visit[tx][ty] = 1;
                st.push(pii(tx, ty));
            }
        }
    }
}

int main()
{
    memset(allow, 0, sizeof(allow));
    memset(visit, 0, sizeof(allow));
    int ax, ay, bx, by, cx, cy, i, j;
    cin >> n;
    cin >> ax >> ay >> bx >> by >> cx >> cy;
    for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (i == ax || j == ay || i + j == ax + ay || i - j == ax - ay) {
				allow[i][j] = 1;
			}
		}
	}

    dfs(bx, by);
    if (visit[cx][cy] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, xq, yq, xr, yr, tx, ty;
    cin >> n;
    cin >> xq >> yq;
    cin >> xr >> yr;
    cin >> tx >> ty;
    if (tx >= xq)
        cout << "NO" << endl;
    else if (ty >= yq)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, xq, yq, xk, yk, tx, ty;
    cin >> n;
    cin >> xq >> yq;
    cin >> xk >> yk;
    cin >> tx >> ty;
    if (xk > xq && tx > xq && yk > yq && ty > yq) cout << "YES" << endl;
    else if (xk < xq && tx < xq && yk > yq && ty > yq) cout << "YES" << endl;
    else if (xk < xq && tx < xq && yk < yq && ty < yq) cout << "YES" << endl;
    else if (xk < xq && tx < xq && yk < yq && ty < yq) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define sp fixed<<setprecision
#define bp __builtin_popcount
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t,i,j,k,l,p,q,r,x,y,z,a,b,c,d,f,n,m,M=1000000007;
	string s;
	vector<ll> v;
	vector<ll> :: iterator itrv;
	unordered_map<ll,ll> N;
	set<ll> S;
	set<ll> :: iterator itr;
    cin>>n;
	cin>>a>>b>>x>>y>>p>>q;
	f=0;
	if(abs(a-b)==abs(p-q)){
		f=1;
	}
	if((a+b)==(c+d)){
		f=1;
	}
	if((x<=a && a<=p) || (p<=a && a<=x)){
		f=1;
	}
	if((y<=b && b<=q) || (q<=b && b<=y)){
		f=1;
	}
	if(f==0){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	return 0;
}

ll modInv(ll a, ll m){
	ll x, y;
	ll g = gcdExtended(a, m, &x, &y);
	ll res = (x%m + m) % m;
	return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
	if (a == 0){
		*x = 0, *y = 1;
		return b;
	}
	ll x1, y1;
	ll gcd = gcdExtended(b%a, a, &x1, &y1);
	*x = y1 - (b/a) * x1;
	*y = x1;
	return gcd;
}

ll mpower(ll x, ll y, ll p){
	ll res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1){
			res = (res*x) % p;
		}
		y = y>>1;
		x = (x*x) % p;
	}
	return res;
}

ll power(ll x, ll y){
	ll res = 1;
	while (y > 0){
		if (y & 1)
			res = res*x;
		y = y>>1;
		x = x*x;
	}
	return res;
}


//  Author : RUTVIK KOTHARI
//  DA-IICT

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define MS(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define INFL LONG_MAX
#define pb push_back
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()
{
    FIO;

    //freopen("input.txt", "r", stdin); // redirects standard input
    //freopen("output.txt", "w", stdout); // redirects standard output

    ll n;
    cin>>n;
    ll x[3],y[3],i,j;
    for(i=0;i<3;i++)
        cin>>x[i]>>y[i];

    if((x[1]<x[0] && x[0]<x[2]) || (x[1]>x[0] && x[0]>x[2]))
        cout<<"NO";
    else if((y[1]<=y[0] && y[0]<=y[2]) || (y[1]>=y[0] && y[0]>=y[2]))
        cout<<"NO";
    else
        cout<<"YES";

    return 0;
}


//  Author : RUTVIK KOTHARI
//  DA-IICT

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define MS(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define INFL LONG_MAX
#define pb push_back
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()
{
    FIO;

    //freopen("input.txt", "r", stdin); // redirects standard input
    //freopen("output.txt", "w", stdout); // redirects standard output

    ll n;
    cin>>n;
    ll x[3],y[3],i,j;
    for(i=0;i<3;i++)
        cin>>x[i]>>y[i];

    if((x[0]>min(x[1],x[2]) && x[0]<max(x[1],x[2])) || (y[0]>min(y[1],y[2]) && y[0]<max(y[1],y[2])))
        cout<<"NO";
    else
        cout<<"YES";

    return 0;
}


//  Author : RUTVIK KOTHARI
//  DA-IICT

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define MS(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define INFL LONG_MAX
#define pb push_back
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()
{
    FIO;

    //freopen("input.txt", "r", stdin); // redirects standard input
    //freopen("output.txt", "w", stdout); // redirects standard output

    ll n;
    cin>>n;
    ll x[3],y[3],i,j;
    for(i=0;i<3;i++)
        cin>>x[i]>>y[i];

    if(x[1]<=x[0] && x[0]<=x[2])
        cout<<"NO";
    else if(y[1]<=y[0] && y[0]<=y[2])
        cout<<"NO";
    else
        cout<<"YES";

    return 0;
}


//  Author : RUTVIK KOTHARI
//  DA-IICT

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define MS(x, y) memset(x, y, sizeof(x))
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define INFL LONG_MAX
#define pb push_back
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()
{
    FIO;

    //freopen("input.txt", "r", stdin); // redirects standard input
    //freopen("output.txt", "w", stdout); // redirects standard output

    ll n;
    cin>>n;
    ll x[3],y[3],i,j;
    for(i=0;i<3;i++)
        cin>>x[i]>>y[i];

    if((x[1]>min(x[0],x[2]) && x[1]<max(x[0],x[2])) || (y[1]>min(y[0],y[2]) && y[1]<max(y[0],y[2])))
        cout<<"NO";
    else
        cout<<"YES";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x,y,a,b,c,d,n;
    cin>>n;
    cin>>x>>y;
    cin>>a>>b;
    cin>>c>>d;
    bool joy=true;
    if(x>a){
    if(x<c)
    {
        cout<<"NO"<<endl;joy=false;
        return 0;
    }
    }
    if(x<a)
    {

        if(x>c){
            cout<<"NO"<<endl;joy=false;return 0;}
    }
    if(y>b)
    {

        if(y<d){
            cout<<"NO"<<endl;return 0;}
    }
    if(y<b)
    {

         if(y>d){
            cout<<"NO"<<endl;return 0;}
    }
    if(joy==true)
    cout<<"YES"<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x,y,a,b,c,d,n;
    cin>>n;
    cin>>x>>y;
    cin>>a>>b;
    cin>>c>>d;
    if(x>c&&y>d)
    {
        cout<<"YES"<<endl;
    }
    else
    cout<<"NO"<<endl;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x,y,a,b,c,d,n;
    cin>>n;
    cin>>x>>y;
    cin>>a>>b;
    cin>>c>>d;
    if(x>c||y>d)
    {
        cout<<"NO"<<endl;
    }
    else
    cout<<"YES"<<endl;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x,y,a,b,c,d,n;
    cin>>n;
    cin>>x>>y;
    cin>>a>>b;
    cin>>c>>d;
    if(x>c||y>d)
    {
        cout<<"YES"<<endl;
    }
    else
    cout<<"NO"<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int pos[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};
int n,ax,ay,cx,cy;
bool vis[1005][1005];
bool isValid(int x, int y){
	return x>=0&&x<n&&y>=0&&y<n;
}

bool dfs(int bx,int by){
	if(bx==cx&&by==cy) return 1;
	vis[bx][by]=1;
	bool ans=0;
	for (int i=0; i<8; i++){
		int dx = bx+pos[i][0];
		int dy = by+pos[i][1];
		if(isValid(dx,dy)&&dx!=ax&&dy!=ay&&abs(dx-ax)!=abs(dy-ay)&&!vis[dx][dy]){

			ans|=dfs(dx,dy);
		}
	}
	return ans;
}

int main(){
	int bx,by;
	cin>>n>>ax>>ay>>bx>>by>>cx>>cy;
	memset(vis,0,sizeof(vis));
	if(dfs(bx,by)) cout << "YES";
	else cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int pos[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};
int n,ax,ay,cx,cy;
bool vis[1005][1005];
bool isValid(int x, int y){
	return x>=0&&x<n&&y>=0&&y<n;
}

bool dfs(int bx,int by){
	if(bx==cx&&by==cy) return 1;
	bool ans=0;
	for (int i=0; i<8; i++){
		int dx = bx+pos[i][0];
		int dy = by+pos[i][1];
		if(isValid(dx,dy)&&dx!=ax&&dy!=ay&&abs(dx-ax)!=abs(dy-ay)&&!vis[dx][dy]){
			vis[dx][dy]=1;
			ans|=dfs(dx,dy);
		}
	}
	return ans;
}

int main(){
	int bx,by;
	cin>>n>>ax>>ay>>bx>>by>>cx>>cy;
	memset(vis,0,sizeof(vis));
	if(dfs(bx,by)) cout << "YES";
	else cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int pos[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};
int n,ax,ay,cx,cy;
bool vis[1005][1005];
bool isValid(int x, int y){
	return x>=0&&x<n&&y>=0&&y<n;
}

bool dfs(int bx,int by){
	if(bx==cx&&by==cy) return 1;
	bool ans=0;
	for (int i=0; i<8; i++){
		int dx = bx+pos[i][0];
		int dy = by+pos[i][1];
		if(isValid(dx,dy)&&dx!=ax&&dy!=ay&&(dx-ax)!=(dy-ay)&&!vis[dx][dy]){
			vis[dx][dy]=1;
			ans|=dfs(dx,dy);
		}
	}
	return ans;
}

int main(){
	int bx,by;
	cin>>n>>ax>>ay>>bx>>by>>cx>>cy;
	memset(vis,0,sizeof(vis));
	if(dfs(bx,by)) cout << "YES";
	else cout << "NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int pos[8][2] = {-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};
int n,ax,ay,cx,cy;
bool vis[1005][1005];
bool isValid(int x, int y){
	return x>=0&&x<n&&y>=0&&y<n;
}

bool dfs(int bx,int by){
	if(bx==cx&&by==cy) return 1;
	vis[bx][by]=1;
	bool ans=0;
	for (int i=0; i<8; i++){
		int dx = bx+pos[i][0];
		int dy = by+pos[i][1];
		if(isValid(dx,dy)&&dx!=ax&&dy!=ay&&abs(dx-ax)!=abs(dy-ay)&&!vis[dx][dy]){

			ans|=dfs(dx,dy);
		}
	}
	return ans;
}

int main(){
	int bx,by;
	cin>>n>>ax>>ay>>bx>>by>>cx>>cy;
	ax--; ay--; bx--; by--; cx--; cy--;
	memset(vis,0,sizeof(vis));
	if(dfs(bx,by)) cout << "YES";
	else cout << "NO";
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[1005][1005]; //cell[x][y]
int d[1005][1005],vis[1005][1005]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Cy+1,j=Cx-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 and tx<row and ty>=0 and ty<col and cell[tx][ty]!=-1 and vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

   /* for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[100][100]; //cell[x][y]
int d[100][100],vis[100][100]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Cy+1,j=Cx-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 and tx<row and ty>=0 and ty<col and cell[tx][ty]!=-1 and vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

   /* for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[1005][1005]; //cell[x][y]
int d[1005][1005],vis[1005][1005]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Ay+1,j=Ax-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;

        //cell[Ay][Ax]
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 && tx<row && ty>=0 && ty<col && cell[tx][ty]!=-1 && vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

    /*for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[1005][1005]; //cell[x][y]
int d[1005][1005],vis[1005][1005]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Cy+1,j=Cx-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 && tx<row && ty>=0 && ty<col && cell[tx][ty]!=-1 && vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

   /* for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0,1,-1,-1,1};
int fy[]={0,0,1,-1,1,-1,1,-1};
int cell[1005][1005]; //cell[x][y]
int d[1005][1005],vis[1005][1005]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Ay+1,j=Ax-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;

        //cell[Ay][Ax]
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<8;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 && tx<row && ty>=0 && ty<col && cell[tx][ty]!=-1 && vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

    /*for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[1005][1005]; //cell[x][y]
int d[1005][1005],vis[1005][1005]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Cy+1,j=Cx-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 and tx<row and ty>=0 and ty<col and cell[tx][ty]!=-1 and vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n-1;
    col = n-1;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

   /* for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[10000][10000]; //cell[x][y]
int d[10000][10000],vis[10000][10000]; //d means destination from source.
int row,col;
int Ax,Ay,Bx,By,Cx,Cy,n;

void setCheck()
{
    //put check on the same row
    for(int j = 0;j<n;j++)
        cell[Ay][j] = -1;

    //put check on the same column
    for(int i=0;i<n;i++)
        cell[i][Ax] = -1;

    //put check on diagonals
    for(int i=Ay+1,j=Ax+1;(i<n && j<n);i++,j++)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax-1;(i>=0 && j>=0);i--,j--)
        cell[i][j] = -1;

    for(int i=Ay-1,j=Ax+1;(i>=0 && j<n);i--,j++)
        cell[i][j] = -1;

    for(int i=Cy+1,j=Cx-1;(i<n && j>=0);i++,j--)
        cell[i][j] = -1;
}

bool bfs(int sx,int sy) //Source node is in [sx][sy] cell.
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q; //A queue containing STL pairs
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k]; //Neighbor cell [tx][ty]
			if(tx>=0 and tx<row and ty>=0 and ty<col and cell[tx][ty]!=-1 and vis[tx][ty]==0) //Check if the neighbor is valid and not visited before.
			{
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				q.push(pii(tx,ty)); //Pushing a new pair in the queue
			}
		}
	}

	if(vis[Cy][Cx] == 1)
        return true;

    return false;
}

int main()
{
    cin>>n;
    cin>>Ax>>Ay;
    cin>>Bx>>By;
    cin>>Cx>>Cy;

    row = n;
    col = n;

    Ay = n - Ay;
    By = n - By;
    Cy = n - Cy;
    Ax--;
    Bx--;
    Cx--;
    setCheck();

   /* for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cout<<cell[i][j]<<" ";
        }
        cout<<endl;
    }*/

    if(bfs(By,Bx))
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int inf32 = 1e9 + 9;
const ll inf64 = 1e18 + 18;
const int N = 1e3 + 3, LG = 32;

bool used[N][N];
int n;
pii a, b, c;

void dfs(pii cur) {
	used[cur.first][cur.second] = true;
	for (int i = -1; i < 2; ++i) {
		for (int j = -1; j < 2; ++j) {
			pii nxt = { cur.first + i, cur.second + j };
			if (!nxt.first || nxt.first > n || !nxt.second || nxt.second > n) continue;
			if (used[nxt.first][nxt.second] || nxt.first == a.first || nxt.second == a.second || (abs(a.first - nxt.first) == abs(a.second - nxt.second)))
				continue;
			dfs(nxt);
		}
	}
}
void Solve() {

	cin >> n >> a.first >> a.second >> b.first >> b.second >> c.first >> c.second;
	dfs(b);
	if (used[c.first][c.second]) cout<<("YES");
	else cout<<("NO");
}

int main()
{

	Solve();

	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int ax,ay,bx,by,cx,cy;
    int n;

    cin >> n;
    if(n>=3&&n<=1000)
    {
        cin >> ax >>ay;
         if(ax>=1&&ax<=n&&ay>=1&&ay<=n)
         {
             cin >> bx >>by;
             if(bx>=1&&bx<=n&&by>=1&&by<=n)
             {
                cin >> cx >>cy;
                if(cx>=1&&cx<=n&&cy>=1&&cy<=n)
                {
                   if(ax!=bx&&ay!=by&&ax!=cx&&ax!=cy&&bx!=cx&&cy!=by)
                   {
                       if(bx<ax&&cx>ax||bx>ax&&cx<ax)
                       {
                          cout << "No";
                       }else if(by<ay&&ay<cy||by>ay&&ay>cy)
                       {
                           cout << "No";
                       }
                       else cout <<"Yes";

                   }
                }
             }
         }
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int ax,ay,bx,by,cx,cy;
    int n;

    cin >> n;
    if(n>=3&&n<=1000)
    {
        cin >> ax >>ay;
         if(ax>=1&&ax<=n&&ay>=1&&ay<=n)
         {
             cin >> bx >>by;
             if(bx>=1&&bx<=n&&by>=1&&by<=n)
             {
                cin >> cx >>cy;
                if(cx>=1&&cx<=n&&cy>=1&&cy<=n)
                {
                   if((ax!=bx||ay!=by)&&(ax!=cx||ax!=cy)&&(bx!=cx||cy!=by))
                   {
                       int i = 1;
                       if(ax>bx&&cx>ax||ax<bx&&cx<ax)
                       {
                          i = 0;
                       }
                       if(ay>by&&cy>ay||ay<by&&cy<ay)
                       {
                           i = 0;
                       }
                       if(i)cout <<"Yes";else cout << "No";

                   }
                }
             }
         }
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int ax,ay,bx,by,cx,cy;
    int n;

    cin >> n;
    if(n>=3&&n<=1000)
    {
        cin >> ax >>ay;
         if(ax>=1&&ax<=n&&ay>=1&&ay<=n)
         {
             cin >> bx >>by;
             if(bx>=1&&bx<=n&&by>=1&&by<=n)
             {
                cin >> cx >>cy;
                if(cx>=1&&cx<=n&&cy>=1&&cy<=n)
                {
                   if(ax!=bx&&ay!=by&&ax!=cx&&ax!=cy&&bx!=cx&&cy!=by)
                   {
                       if(ax>bx&&cx>ax||ax<bx&&cx<ax)
                       {
                          cout << "No";
                       }else if(ay>by&&cy>ay||ay<by&&cy<ay)
                       {
                           cout << "No";
                       }
                       else cout <<"Yes";

                   }
                }
             }
         }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1010;

int dir[5] = {1,0,-1,0,1};
int n;
int m[N][N];

void dfs(int x, int y){
  for(int k = 0;k < 4;k++){
    int i = dir[k], j = dir[k+1];

    if(x + i < n && x + i >= 0 && y + j < n && y + j >= 0 && m[x + i][y + j] != 2 && m[x + i][y + j] != 1){
      m[x + i][y + j] = 2;
      dfs(x+i,y+j);
    }
  }
  return;
}

int main(){
  int ax,ay,bx,by,cx,cy;
  cin >> n >> ax >> ay >> bx >> by >> cx >> cy;

  for(int i = 0;i < n;i++)
    m[ax][i] = m[i][ay] = 1;

  dfs(bx,by);

  if(m[cx][cy] == 2) cout << "YES";
  else cout << "NO";
}


#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  cin >> n;
  int ax,ay,bx,by,cx,cy;
  cin >> ax >> ay >> bx >> by >> cx >> cy;

  if((cx > ax && bx < ax) || (cy > ay && by < ay) || (cx < ax && bx > ax) || (cy < ay && by > ay)) cout << "NO",exit(0);
  cout << "YES" << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1010;

int dir[5] = {1,0,-1,0,1};
int n;
int m[N][N];

void dfs(int x, int y){
  for(int k = 0;k < 4;k++){
    int i = dir[k], j = dir[k+1];

    if(x + i <= n && x + i > 0 && y + j <= n && y + j > 0 && m[x + i][y + j] != 2 && m[x + i][y + j] != 1){
      m[x + i][y + j] = 2;
      dfs(x+i,y+j);
    }
  }
  return;
}

int main(){
  int ax,ay,bx,by,cx,cy;
  cin >> n >> ax >> ay >> bx >> by >> cx >> cy;

  for(int i = 1;i <= n;i++)
    m[ax][i] = m[i][ay] = 1;

  dfs(bx,by);

  if(m[cx][cy] == 2) cout << "YES";
  else cout << "NO";
}


#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  cin >> n;
  int ax,ay,bx,by,cx,cy;
  cin >> ax >> ay >> bx >> by >> cx >> cy;

  if((cx > ax && bx < ax) || (cy > ay && by < ay) || (cx < ax && bx > cx) || (cy < ay && by > ay)) cout << "NO",exit(0);
  cout << "YES" << endl;
}


                                   //BISMILLAHIR RAHMANIR RAHEEM
                                      //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include<bits/stdc++.h>

//#define ull    unsigned long long
#define ll    long long
#define ses   "\n"
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

using namespace std;
 // Using DFS...........

bool vis[1001][1001];
ll n;
 void dfs(int x, int y){
     vis[x][y] = 1;
    for(ll i=0;i<8;i++)
    {
        int xx = x+dx8[i];
        int yy = y+dy8[i];
        if(xx<1 || xx>n || yy<1 || yy>n || vis[xx][yy]) continue;
        dfs(xx,yy);
    }
 }
//main function is here.... ....
int main(){

cin>>n;
ll a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
for(ll i=1;i<=n;i++){
    vis[i][b]=1;
    vis[a][i]=1;
}
for(ll i=a,j=b;i>0 && j>0 ;i--,j--){
    vis[i][j]=1;
}
dfs(c,d);
 if(vis[e][f])
        cout << "YES\n";
    else cout << "NO\n";
    return 0;
}

//Alhamdulillah


                                   //BISMILLAHIR RAHMANIR RAHEEM
                                      //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include<bits/stdc++.h>

//#define ull    unsigned long long
#define ll    long long
#define ses   "\n"

using namespace std;

//main function is here.... ....
int main(){
ll n;
cin>>n;
ll a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
if(a>c && b>d && a>e && b>f ){
    cout<<"YES";return 0;
}
else{
    cout<<"NO";
}
}

//Alhamdulillah


                                   //BISMILLAHIR RAHMANIR RAHEEM
                                      //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include<bits/stdc++.h>

//#define ull    unsigned long long
#define ll    long long
#define ses   "\n"

using namespace std;

//main function is here.... ....
int main(){
ll n;
cin>>n;
ll a,b;
cin>>a>>b;
ll mxa = max(a,b);
ll c,d;
cin>>c>>d;
ll mxc = max(c,d);
ll e,f;
cin>>e>>f;
ll mxe = max(e,f);
if(mxa<= mxc && mxa>=mxe || mxa>= mxc && mxa<=mxe){
    cout<<"NO";
}
else{
    cout<<"YES";
}
}

//Alhamdulillah


                                   //BISMILLAHIR RAHMANIR RAHEEM
                                      //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include<bits/stdc++.h>

//#define ull    unsigned long long
#define ll    long long
#define ses   "\n"

using namespace std;

//main function is here.... ....
int main(){
ll n;
cin>>n;
ll a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
if(a>c && b>d && a>e && b>f || a>c && b<d && a>e && b<f || a<c && b>d && a<e && b>f || a<c && b<d && a<e && b<f){
    cout<<"YES";return 0;
}
else{
    cout<<"NO";
}
}

//Alhamdulillah


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
int n, m[1111][1111];
queue<pii> q;
pii a,b,c, tmp,t;
bool isvalid(pii x)
{
	if(x.fi<1||x.fi>n||x.se<1||x.se>n)
		return false;
	if(x.fi==a.fi||x.se==a.se||x.fi+x.se==a.fi+a.se||x.fi-x.se==a.fi-a.se)
		return false;
	if(m[x.fi][x.se]==1)
		return false;
	return true;
}
int main()
{
	cin>>n;
	cin>>a.fi>>a.se>>b.fi>>b.se>>c.fi>>c.se;
	q.push(b);
	while(!q.empty())
	{
		tmp=q.front();
		q.pop();
		m[tmp.fi][tmp.se]=1;
		if(tmp.fi==c.fi&&tmp.se==c.se)
		{
			cout<<"YES"<<endl;
			exit(0);
		}
		for(int i=-1; i<=1; i++)
		for(int j=-1; j<=1; j++)
		if(i==0&&j==0)	continue;
		else
		{
			t=make_pair(tmp.fi+i,tmp.se+j);
			if(isvalid(t))
			{
				q.push(t);
				m[t.fi][t.se]=1;
			}
		}
	}
	cout<<"NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
int n, m[1111][1111];
stack<pii> s;
pii a,b,c, tmp,t;
bool isvalid(pii x)
{
	if(x.fi<1||x.fi>n||x.se<1||x.se>n)
		return false;
	if(x.fi==a.fi||x.se==a.se||x.fi+x.se==a.fi+a.se||x.fi-x.se==a.fi-a.se)
		return false;
	if(m[x.fi][x.se]==1)
		return false;
	return true;
}
main()
{
	cin>>n;
	cin>>a.fi>>a.se>>b.fi>>b.se>>c.fi>>c.se;
	s.push(b);
	while(!s.empty())
	{
		tmp=s.top();
		s.pop();
		m[tmp.fi][tmp.se]=1;
		if(tmp.fi==c.fi&&tmp.se==c.se)
		{
			cout<<"YES"<<endl;
			exit(0);
		}
		for(int i=-1; i<=1; i++)
		for(int j=-1; j<=1; j++)
		if(i==0&&j==0)	continue;
		else
		{
			t=make_pair(tmp.fi+i,tmp.se+j);
			s.push(t);
		}
	}
	cout<<"NO";
}


#include <bits/stdc++.h>
	using namespace std;
	#define fi first
	#define se second
	#define pii pair<int,int>
	int n, m[1111][1111];
	queue<pii> q;
	pii a,b,c, tmp,t;
	bool isvalid(pii x)
	{
		if(x.fi<1||x.fi>n||x.se<1||x.se>n)
			return false;
		if(x.fi==a.fi||x.se==a.se||x.fi+x.se==a.fi+a.se||x.fi-x.se==a.fi-a.se)
			return false;
		if(m[x.fi][x.se]==1)
			return false;
		return true;
	}
	int main()
	{
		cin>>n;
		cin>>a.fi>>a.se>>b.fi>>b.se>>c.fi>>c.se;
		q.push(b);
		while(!q.empty())
		{
			tmp=q.front();
			q.pop();
			m[tmp.fi][tmp.se]=1;
			if(tmp.fi==c.fi&&tmp.se==c.se)
			{
				cout<<"YES"<<endl;
				exit(0);
			}
			for(int i=-1; i<=1; i++)
			for(int j=-1; j<=1; j++)
			if(i==0&&j==0)	continue;
			else
			{
				t=make_pair(tmp.fi+i,tmp.se+j);
				if(isvalid(t))
				q.push(t);
			}
		}
		cout<<"NO";
		return 0;
	}


#include <bits/stdc++.h>

using namespace std;

double EPS = 1e-7;

namespace c_double{
	struct c_double{
		double d;
		c_double(double d):d(d){}
		c_double operator+(c_double r){
			return d+r.d;
		}
		c_double operator-(){
			return -d;
		}
		c_double operator-(c_double r){
			return (*this)+(-r);
		}
		c_double operator*(c_double r){
			return d*r.d;
		}
		c_double operator/(c_double r){
			return d/r.d;
		}
		bool operator==(c_double r){
			return fabs(d - r.d) < EPS;
		}
		bool operator<(c_double r){
			return d < r.d - EPS;
		}
		bool operator>(c_double r){
			return d > r.d + EPS;
		}
	};
	ostream& operator<<(ostream &out, c_double c){
		return out << c.d;
	}

	istream &operator>>(istream &in, c_double &c){
		return in >> c.d;
	}
}

template<typename T> struct matrix {
	vector<vector<T>> in;
	int row, col;
	matrix(int row, int col, int op = 0):row(row), col(col), in(row, vector<T>(col, 0)){
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				in[i][j] = 0;
		if (op) for (int i = 0; i < row; i++) in[i][i] = 1;
	}
	matrix(initializer_list<initializer_list<T>> c):
		row(c.size()), col((*c.begin()).size()){
			in = vector<vector<T>>(row, vector<T>(col, 0));
			int i, j;
			i = 0;
			for (auto &it : c){
				j = 0;
				for (auto &jt : it){
					in[i][j] = jt;
					j++;
				}
				i++;
			}
		}
	T &operator()(int i, int j){ return in[i][j]; }
	matrix<T>& operator*=(T t){
		matrix<T> &l = *this;
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				l(i, j) = l(i, j) * t;
		return l;
	}
	matrix<T> operator+(matrix<T> &r){
		matrix<T> &l = *this;
		matrix<T> m(row, col, 0);
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				m(i, j) = l(i, j) + r(i, j); //% MOD) % MOD;
		return m;
	}
	matrix<T> operator*(matrix<T> &r){
		matrix<T> &l = *this;
		int row = l.row;
		int col = r.col;
		int K = l.col;
		matrix<T> m(row, col, 0);
		for (int i = 0; i < row; i++)
			for (int k = 0; k < K; k++)
				for (int j = 0; j < col; j++)
					m(i, j) = m(i, j) +  l(i, k) * r(k, j);
		return m;
	}
	void multiply_r(int i, T k){
		matrix<T> &m = (*this);
		for (int j = 0; j < col; j++)
			m(i, j) = m(i, j) * k;

	}
	void multiply_c(int j, T k){
		matrix<T> &m = (*this);
		for (int i = 0; i < row; j++)
			m(i, j) = m(i, j) * k;
	}
	void sum_r(int i1, int i2, T k){
		matrix<T> &m = (*this);
		for (int j = 0; j < col; j++)
			m(i1, j) = m(i1, j) + k*m(i2, j);
	}
	bool gaussian(int I, int J){
		matrix<T> &m = (*this);
		T tmp = m(I, J);
		if (tmp == 0){
			throw logic_error("pivoting error");
			return false;
		}
		m.multiply_r(I, T(1)/tmp);
		for (int i = 0; i < m.row; i++)
			if (i != I) m.sum_r(i, I, -m(i, J));

		return true;
	}
};

template<typename T> struct linear_programming{
	static const int INFEASIBLE = 1, UNBOUNDED = 2, OPT = 3, ERROR = -1;
	int simplex(matrix<T> &t, int n, int m, int c_r, vector<int> &basis){
		int N = n+2, M = m+n+n+1;
		for (int i = 0; i < n; i++)
			t.gaussian(i, basis[i]);
		while (true){
			int J = -1;
			for (int j = 0; j < M-1; j++){
				if (t(c_r, j) < 0 && (J == -1 || t(c_r, j) < t(c_r, J)))
					J = j;
			}
			if (J == -1) return OPT;
			int I = -1;
			for (int i = 0; i < N-2; i++){
				if (t(i, J) > 0){
					I = i;
					break;
				}
			}
			if (I == -1) {
				basis.push_back(J);
				return UNBOUNDED;
			}
			for (int i = 0; i < N-2; i++){
				if (t(i, J) < 0 || t(i, J) == 0) continue;
				if (t(i, M-1)/t(i, J) < t(I, M-1)/t(I, J)) I = i;
			}
			t.gaussian(I, J);
			basis[I] = J;
		}
		return ERROR;
	}

	int solve(matrix<T> &t, int n, int m, vector<int> &basis){
		int N = n+2, M = m+n+n+1;
		int first_step = simplex(t, n, m, N-1, basis);
		T o = t(N-1, M-1);
		if (o < 0) return INFEASIBLE;
		int second_step = simplex(t, n, m, N-2, basis);
		return second_step;
	}
};

int main(){
	cout << fixed << setprecision(10);

	int k, p, q;
	cin >> k >> p >> q;
	vector<int> a(k), b(k);
	for (int i = 0; i < k; i++)
		cin >> a[i] >> b[i];

	int n = 2, m = k;
	int N = n+2, M = m+n+n+1;

	matrix<c_double::c_double> t(N, M+n, 0);
	for (int j = 0; j < m; j++)
		t(n, j) = -1;//c
	t.multiply_r(n, -1);

	for (int i = 0; i < n; i++){
		t(n, m+n+i) = 99999;
		t(N-1, m+n+i) = 1;//aux
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			t(i, M + j) = (i == j);

	vector<int> basis(n);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (i == 0) t(i, j) = -a[j];
			else t(i, j) = -b[j];
		}
		t(i, m+i) = 1;
		if (i == 0) t(i, M-1) = -p;
		else t(i, M-1) = -q;
		if (t(i, M-1) < 0) t.multiply_r(i, -1);
		basis[i] = m+n+i;
		t(i, m+n+i) = 1;
	}
	linear_programming<c_double::c_double> LP;
	int key = LP.solve(t, n, m, basis);
	cout << -t(N-2, M-1) << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

double EPS = 0;

namespace c_double{
	struct c_double{
		long double d;
		c_double(long double d):d(d){}
		c_double operator+(c_double r){
			return d+r.d;
		}
		c_double operator-(){
			return -d;
		}
		c_double operator-(c_double r){
			return (*this)+(-r);
		}
		c_double operator*(c_double r){
			return d*r.d;
		}
		c_double operator/(c_double r){
			return d/r.d;
		}
		bool operator==(c_double r){
			return ((d + EPS) > r.d) && ((d-EPS) < r.d);
		}
		bool operator<(c_double r){
			return d < r.d - EPS;
		}
		bool operator>(c_double r){
			return d > r.d + EPS;
		}
	};
}

template<typename T> struct matrix {
	vector<vector<T>> in;
	int row, col;
	matrix(int row, int col, int op = 0):row(row), col(col), in(row, vector<T>(col, 0)){
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				in[i][j] = 0;
		if (op) for (int i = 0; i < row; i++) in[i][i] = 1;
	}
	matrix(initializer_list<initializer_list<T>> c):
		row(c.size()), col((*c.begin()).size()){
			in = vector<vector<T>>(row, vector<T>(col, 0));
			int i, j;
			i = 0;
			for (auto &it : c){
				j = 0;
				for (auto &jt : it){
					in[i][j] = jt;
					j++;
				}
				i++;
			}
		}
	T &operator()(int i, int j){ return in[i][j]; }
	matrix<T>& operator*=(T t){
		matrix<T> &l = *this;
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				l(i, j) = l(i, j) * t;
		return l;
	}
	matrix<T> operator+(matrix<T> &r){
		matrix<T> &l = *this;
		matrix<T> m(row, col, 0);
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				m(i, j) = l(i, j) + r(i, j); //% MOD) % MOD;
		return m;
	}
	matrix<T> operator*(matrix<T> &r){
		matrix<T> &l = *this;
		int row = l.row;
		int col = r.col;
		int K = l.col;
		matrix<T> m(row, col, 0);
		for (int i = 0; i < row; i++)
			for (int k = 0; k < K; k++)
				for (int j = 0; j < col; j++)
					m(i, j) = m(i, j) +  l(i, k) * r(k, j);
		return m;
	}
	void multiply_r(int i, T k){
		matrix<T> &m = (*this);
		for (int j = 0; j < col; j++)
			m(i, j) = m(i, j) * k;

	}
	void multiply_c(int j, T k){
		matrix<T> &m = (*this);
		for (int i = 0; i < row; j++)
			m(i, j) = m(i, j) * k;
	}
	void sum_r(int i1, int i2, T k){
		matrix<T> &m = (*this);
		for (int j = 0; j < col; j++)
			m(i1, j) = m(i1, j) + k*m(i2, j);
	}
	bool gaussian(int I, int J){
		matrix<T> &m = (*this);
		T tmp = m(I, J);
		if (tmp == 0){
			throw logic_error("pivoting error");
			return false;
		}
		m.multiply_r(I, T(1)/tmp);
		for (int i = 0; i < m.row; i++)
			if (i != I) m.sum_r(i, I, -m(i, J));

		return true;
	}
};

template<typename T> struct linear_programming{
	static const int INFEASIBLE = 1, UNBOUNDED = 2, OPT = 3, ERROR = -1;
	int simplex(matrix<T> &t, int n, int m, int c_r, vector<int> &basis){
		int N = n+2, M = m+n+n+1;
		for (int i = 0; i < n; i++)
			t.gaussian(i, basis[i]);
		while (true){
			int J = -1;
			for (int j = 0; j < M-1; j++){
				if (t(c_r, j) < 0 && (J == -1 || t(c_r, j) < t(c_r, J)))
					J = j;
			}
			if (J == -1) return OPT;
			int I = -1;
			for (int i = 0; i < N-2; i++){
				if (t(i, J) > 0){
					I = i;
					break;
				}
			}
			if (I == -1) {
				basis.push_back(J);
				return UNBOUNDED;
			}
			for (int i = 0; i < N-2; i++){
				if (t(i, J) < 0 || t(i, J) == 0) continue;
				if (t(i, M-1)/t(i, J) < t(I, M-1)/t(I, J)) I = i;
			}
			t.gaussian(I, J);
			basis[I] = J;
		}
		return ERROR;
	}

	T solve(matrix<T> &t, int n, int m, vector<int> &basis){
		int N = n+2, M = m+n+n+1;
		int first_step = simplex(t, n, m, N-1, basis);
		T o = t(N-1, M-1);
		//if (o < 0) return INFEASIBLE;
		int second_step = simplex(t, n, m, N-2, basis);
		T ans = t(N-2, M-1);
		return ans;
	}
};

int main(){
	cout << fixed << setprecision(10);

	int k, p, q;
	cin >> k >> p >> q;
	vector<int> a(k), b(k);
	for (int i = 0; i < k; i++)
		cin >> a[i] >> b[i];

	int n = 2, m = k;
	int N = n+2, M = m+n+n+1;

	matrix<c_double::c_double> t(N, M+n, 0);
	for (int j = 0; j < m; j++)
		t(n, j) = -1;//c
	t.multiply_r(n, -1);

	for (int i = 0; i < n; i++){
		t(n, m+n+i) = 1000;
		t(N-1, m+n+i) = 1;//aux
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			t(i, M + j) = (i == j);

	vector<int> basis(n);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (i == 0) t(i, j) = -a[j];
			else t(i, j) = -b[j];
		}
		t(i, m+i) = 1;
		if (i == 0) t(i, M-1) = -p;
		else t(i, M-1) = -q;
		if (t(i, M-1) < 0) t.multiply_r(i, -1);
		basis[i] = m+n+i;
		t(i, m+n+i) = 1;
	}
	linear_programming<c_double::c_double> LP;
	auto key = LP.solve(t, n, m, basis);
	cout << -t(N-2, M-1).d << endl;
	return 0;
}