Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A. Square and Rectangles

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given *n* rectangles. The corners of rectangles have integer coordinates and their edges are parallel to the *Ox* and *Oy* axes. The rectangles may touch each other, but they do not overlap (that is, there are no points that belong to the interior of more than one rectangle).

Your task is to determine if the rectangles form a square. In other words, determine if the set of points inside or on the border of at least one rectangle is precisely equal to the set of points inside or on the border of some square.

Input

The first line contains a single integer *n* (1 ≤ *n* ≤ 5). Next *n* lines contain four integers each, describing a single rectangle: *x*_{1}, *y*_{1}, *x*_{2}, *y*_{2} (0 ≤ *x*_{1} < *x*_{2} ≤ 31400, 0 ≤ *y*_{1} < *y*_{2} ≤ 31400) — *x*_{1} and *x*_{2} are *x*-coordinates of the left and right edges of the rectangle, and *y*_{1} and *y*_{2} are *y*-coordinates of the bottom and top edges of the rectangle.

No two rectangles overlap (that is, there are no points that belong to the interior of more than one rectangle).

Output

In a single line print "YES", if the given rectangles form a square, or "NO" otherwise.

Examples

Input

5

0 0 2 3

0 3 3 5

2 0 5 2

3 2 5 5

2 2 3 3

Output

YES

Input

4

0 0 2 3

0 3 3 5

2 0 5 2

3 2 5 5

Output

NO

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/01/2020 12:27:29 (f3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|