#K14401. Largest Lit Square

    ID: 24126 Type: Default 1000ms 256MiB

Largest Lit Square

Largest Lit Square

In Gridland, some intersections are dark due to malfunctioning lights. You are given n dark intersections with their coordinates. Your task is to determine the side length of the largest possible square area that is fully lit – that is, the square must not contain any dark intersection.

If there are no dark intersections (n = 0), the entire grid remains lit, and the output should be Infinity.

You can determine the side length of the largest lit square by computing the differences between the minimum and maximum x-coordinates and y-coordinates among the dark intersections, then taking the larger value. In mathematical notation, if the dark intersections are given by their x-coordinates and y-coordinates, then the side length is:

\( side = \max( x_{\max} - x_{\min},\; y_{\max} - y_{\min} ) \)

Note that when there is exactly one dark intersection or all dark intersections are at the same coordinate, no square area can be formed, so the answer is 0.

inputFormat

The first line contains an integer n (n ≥ 0) indicating the number of dark intersections.

If n > 0, each of the next n lines contains two space-separated integers representing the x and y coordinates of a dark intersection.

If n = 0, there are no further inputs.

outputFormat

Print a single value representing the side length of the largest possible square area that is fully lit.

If there are no dark intersections, print Infinity (without quotes).

## sample
0
Infinity

</p>