Fosa

No attempts yetTime limit1sMemory limit128 MB

Problem

King Bajtomir's armies have just conquered another strip of land that until recently belonged to the kingdom of Bitocja. To hold this territory, a stronghold must be built. The king's subjects are very skilled at raising stone-and-brick structures of any size, but the one thing they cannot stand is digging ditches. And as everyone knows, for safety every stronghold must be surrounded by a deep moat.

Luckily, the conquered land is crossed by quite a few streams, so the court architect Bajtazar decided to use them as a natural moat. He is now wondering where to place the stronghold so that it is surrounded by streams on every side. Bajtazar loves symmetry, so the stronghold must be built on the plan of a square, and because it has to house the unit assigned to defend the territory, it must be as large as possible.

The royal surveyors marked the streams on a rectangular map. Each stream is a segment parallel to one of the map's edges. Segments that represent different streams may share more than one point (that is, they may run beside each other at a negligible distance). On the map the stronghold is drawn as a square. It must be placed so that every point of its perimeter lies on some segment that represents a stream. It does not matter if a stream segment crosses the interior of the square (the stream would then flow beneath the stronghold). Such a stream can be blocked off with a grate, and it also makes it easier for the cook to feed the crocodiles swimming in the moat.

Help Bajtazar answer whether a stronghold meeting these requirements can be built. If it can, also determine the maximum side length of the square that represents the stronghold.

Input

The first line contains a single integer nn (1n50001 \le n \le 5000), the number of segments that represent streams on the map. Each of the next nn lines describes one segment with four integers x1x_1, y1y_1, x2x_2, y2y_2 (109x1,y1,x2,y2109-10^9 \le x_1, y_1, x_2, y_2 \le 10^9, and x1=x2x_1 = x_2 or y1=y2y_1 = y_2), meaning that the segment joins the points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2).

Output

Print the word NIE if no stronghold satisfying the architect's requirements can be built. Otherwise, print a single positive integer, the maximum side length of the square that represents the stronghold.

Hint

An illustration of the sample.