Filled with optimism, Hyunuk will host a conference about how great this new year will be!

The conference will have n lectures. Hyunuk has two candidate venues a and b. For each of the n lectures, the speaker specified two time intervals [sa_i, ea_i] (sa_i ≤ ea_i) and [sb_i, eb_i] (sb_i ≤ eb_i). If the conference is situated in venue a, the lecture will be held from sa_i to ea_i, and if the conference is situated in venue b, the lecture will be held from sb_i to eb_i. Hyunuk will choose one of these venues and all lectures will be held at that venue.

Two lectures are said to overlap if they share any point in time in common. Formally, a lecture held in interval [x, y] overlaps with a lecture held in interval [u, v] if and only if max(x, u) ≤ min(y, v).

We say that a participant can attend a subset s of the lectures if the lectures in s do not pairwise overlap (i.e. no two lectures overlap). Note that the possibility of attending may depend on whether Hyunuk selected venue a or venue b to hold the conference.

A subset of lectures s is said to be venue-sensitive if, for one of the venues, the participant can attend s, but for the other venue, the participant cannot attend s.

A venue-sensitive set is problematic for a participant who is interested in attending the lectures in s because the participant cannot be sure whether the lecture times will overlap. Hyunuk will be happy if and only if there are no venue-sensitive sets. Determine whether Hyunuk will be happy.

Input

The first line contains an integer n (1 ≤ n ≤ 100 000), the number of lectures held in the conference.

Each of the next n lines contains four integers sa_i, ea_i, sb_i, eb_i (1 ≤ sa_i, ea_i, sb_i, eb_i ≤ 10^9, sa_i ≤ ea_i, sb_i ≤ eb_i).

Output

Print "YES" if Hyunuk will be happy. Print "NO" otherwise.

You can print each letter in any case (upper or lower).

Examples

Input


2
1 2 3 6
3 4 7 8


Output


YES


Input


3
1 3 2 4
4 5 6 7
3 4 5 5


Output


NO


Input


6
1 5 2 9
2 4 5 8
3 6 7 11
7 10 12 16
8 11 13 17
9 12 14 18


Output


YES

Note

In second example, lecture set \{1, 3\} is venue-sensitive. Because participant can't attend this lectures in venue a, but can attend in venue b.

In first and third example, venue-sensitive set does not exist.
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class D {
    static final Random random = new Random();
    static long pow1[], pow2[], mod1 = 1000000097L, mod2 = (long) 1e9 + 9;
    static long base1 = randomPrime((int)2e5), base2 = randomPrime((int)2e5);

    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = in.nextInt();
        int a[][] = new int[n][2];
        int b[][] = new int[n][2];
        for (int i = 0; i < n; i++) {
            a[i][0] = in.nextInt();
            a[i][1] = in.nextInt();
            b[i][0] = in.nextInt();
            b[i][1] = in.nextInt();
        }

        preCal(n);

        long hashA[] = getIntersectionHashes(n, a);
        long hashB[] = getIntersectionHashes(n, b);

        if (Arrays.equals(hashA, hashB)) pw.println("YES");
        else pw.println("NO");

        pw.close();
    }

    static void preCal(int n) {
        pow1 = new long[n + 1];
        pow2 = new long[n + 1];
        pow1[0] = pow2[0] = 1;
        for (int i = 1; i <= n; i++) {
            pow1[i] = (pow1[i - 1] * base1) % mod1;
            pow2[i] = (pow2[i - 1] * base2) % mod2;
        }
    }

    static long[] getIntersectionHashes(int n, int arr[][]) {
        TreeMap<Integer, long[]> start = new TreeMap<>();
        TreeMap<Integer, long[]> end = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            int l = arr[i][0], r = arr[i][1];
            {
                long h[] = start.getOrDefault(l, new long[2]);
                addHash(h, i);
                start.put(l, h);
            }
            {
                long h[] = end.getOrDefault(r, new long[2]);
                addHash(h, i);
                end.put(r, h);
            }
        }

        buildMap(start);
        buildMap(end);

        long hash[] = new long[n];
        for (int i = 0; i < n; i++) {
            int l = arr[i][0], r = arr[i][1];
            long ended[] = end.lowerEntry(l).getValue();
            long started[] = start.floorEntry(r).getValue();
            hash[i] = getOverlapHash(ended, started);
        }

        return hash;
    }

    static long getOverlapHash(long ended[], long started[]) {
        long a = mod(started[0] - ended[0], mod1);
        long b = mod(started[1] - ended[1], mod2);
        return (a << 31) | b;
    }

    static void buildMap(TreeMap<Integer, long[]> map) {
        long hash[] = new long[2];
        map.put(0, new long[2]);
        for (int key : map.keySet()) {
            long h[] = map.get(key);
            addHash(h, hash);
            hash = h;
        }
    }

    static void addHash(long a[], long b[]) {
        a[0] = mod(a[0] + b[0], mod1);
        a[1] = mod(a[1] + b[1], mod2);
    }

    static void addHash(long h[], int idx) {
        h[0] = mod(h[0] + pow1[idx], mod1);
        h[1] = mod(h[1] + pow2[idx], mod2);
    }

    static long mod(long v, long m) {
        if (v < 0) v += m;
        if (v >= m) v -= m;
        return v;
    }

    static long[] getHash(int idx) {
        return new long[]{pow1[idx], pow2[idx]};
    }

    static long getHash(long h[]) {
        return (h[0] << 31) | h[1];
    }


    static int randomPrime(int n) {
        return BigInteger.valueOf(random.nextInt(n) + (n / 2)).nextProbablePrime().intValue();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }

    static class FastReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0, ptrbuf = 0;

        public FastReader(InputStream is) {
            this.is = is;
        }

        public int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        public String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }


        public String nextLine() {
            int c = skip();
            StringBuilder sb = new StringBuilder();
            while (!isEndOfLine(c)) {
                sb.appendCodePoint(c);
                c = readByte();
            }
            return sb.toString();
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        public long nextLong() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

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

        public char[] next(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        public char readChar() {
            return (char) skip();
        }
    }
}