CF325A Square and Rectangles

Description

You 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 Format

The first line contains a single integer $ n $ ( $ 1

Output Format

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