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.
// package CodeForces;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Random;

public class Hello2020D {
	
	public static Random rng = new Random();
	
	public static long GetRandom() {
		return Math.abs(rng.nextLong());
	}
	
	public static void solve() {
		int n = s.nextInt();
		Pair[] A = new Pair[n];
		Pair[] Ae = new Pair[n];
		Pair[] B = new Pair[n];
		Pair[] Be = new Pair[n];
		HashSet<Long> used = new HashSet<Long>();
		for(int i = 0; i < n; i++) {
			long x = GetRandom();
			while(used.contains(x)) {
				x = GetRandom();
			}
			used.add(x);
			A[i] = new Pair(s.nextInt(), s.nextInt(), x, i);
			Ae[i] = A[i];
			B[i] = new Pair(s.nextInt(), s.nextInt(), x, i);
			Be[i] = B[i];
		}
		Arrays.parallelSort(A);
		Arrays.parallelSort(B);
		sort_flag = false;
		Arrays.parallelSort(Ae);
		Arrays.parallelSort(Be);
		long[] pA = new long[n];
		long[] pAe = new long[n];
		long[] pB = new long[n];
		long[] pBe = new long[n];
		for(int i = 0; i < n; i++) {
			if(i == 0) {
				pA[i] = A[i].random;
				pAe[i] = Ae[i].random;
				pB[i] = B[i].random;
				pBe[i] = Be[i].random;
			}else {
				pA[i] = A[i].random ^ pA[i - 1];
				pAe[i] = Ae[i].random ^ pAe[i - 1];
				pB[i] = B[i].random ^ pB[i - 1];
				pBe[i] = Be[i].random ^ pBe[i - 1];
			}
		}
		long[] first = new long[n];
		for(int i = 0; i < n; i++) {
			int s_e = UB(A[i].s, Ae); // end smaller than my_start
			int e_s = LB(A[i].e, A); // start greater than my_end
			long val1 = s_e == -1 ? 0 : pAe[s_e];
			long val2 = e_s == -1 ? 0 : (e_s == 0 ? 0 : pA[e_s - 1]) ^ pA[n - 1];
			first[A[i].idx] = val1 ^ val2;
		}
		long[] second = new long[n];
		for(int i = 0; i < n; i++) {
			int s_e = UB(B[i].s, Be); // end smaller than my_start
			int e_s = LB(B[i].e, B); // start greater than my_end
			long val1 = s_e == -1 ? 0 : pBe[s_e];
			long val2 = e_s == -1 ? 0 : (e_s == 0 ? 0 : pB[e_s - 1]) ^ pB[n - 1];
			second[B[i].idx] = val1 ^ val2;
		}
		boolean ok = true;
		for(int i = 0; i < n; i++) {
			ok &= first[i] == second[i];
		}
		out.println(ok ? "YES" : "NO");
	}
	
	public static int LB(int val, Pair[] arr) { // first point greater than end
		int start = 0;
		int end = arr.length - 1;
		int ans = -1;
		while(start <= end) {
			int mid = (start + end)>>1;
			if(arr[mid].s <= val) {
				start = mid + 1;
			}else {
				ans = mid;
				end = mid - 1;
			}
		}
		return ans;
	}
	
	public static int UB(int val, Pair[] arr) { // last point smaller than start
		int start = 0;
		int end = arr.length - 1;
		int ans = -1;
		while(start <= end) {
			int mid = (start + end)>>1;
			if(arr[mid].e < val) {
				start = mid + 1;
				ans = mid;
			}else {
				end = mid - 1;
			}
		}
		return ans;
	}
	
	public static boolean sort_flag = true; // set for start and unset for end
	
	public static class Pair implements Comparable<Pair> {
		int s, e;
		int idx;
		long random;
		
		public Pair(int s, int e, long random, int idx) {
			this.s = s;
			this.e = e;
			this.random = random;
			this.idx = idx;
		}
		
		public int compareTo(Pair x) {
			if(sort_flag) {
				return this.s - x.s;
			}else {
				return this.e - x.e;
			}
		}
	}

	public static void main(String[] args) {
		new Thread(null, null, "Thread", 1 << 27) {
			public void run() {
				try {
					out = new PrintWriter(new BufferedOutputStream(System.out));
					s = new FastReader(System.in);
					solve();
					out.close();
				} catch (Exception e) {
					e.printStackTrace();
					System.exit(1);
				}
			}
		}.start();
	}
	
	public static PrintWriter out;
	public static FastReader s;

	public static class FastReader {

		private InputStream stream;
		private byte[] buf = new byte[4096];
		private int curChar, snumChars;

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

		public int read() {
			if (snumChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException E) {
					throw new InputMismatchException();
				}
			}
			if (snumChars <= 0) {
				return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int number = 0;
			do {
				number *= 10;
				number += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long number = 0;
			do {
				number *= 10L;
				number += (long) (c - '0');
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = this.nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = this.nextLong();
			}
			return arr;
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndofLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

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

	}

}
