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.
The first line contains a single integer n (1≤n≤5000), the number of segments that represent streams on the map. Each of the next n lines describes one segment with four integers x1, y1, x2, y2 (−109≤x1,y1,x2,y2≤109, and x1=x2 or y1=y2), meaning that the segment joins the points (x1,y1) and (x2,y2).
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.

An illustration of the sample.