Under construction

Still being built. Things may change

TATCK

Interview

Time limit2sMemory limit512 MB

Summary
For each test case, find the area of the smallest axis-aligned square that contains all given points.
Level

Medium4 of 10

Topics
Geometry, Math, Implementation, Brute force
Solved
No attempts yet

Problem

Last night the Taliban attacked a police station. The Afghan National Police fought them and repelled the attack by killing all of them. After the attack, however, the police noticed a strange pattern of tiny holes in the station's wall. They decide to cover these holes temporarily with bulletproof sheet metal. The sheets come only in square shapes of different sizes, so they must use them to cover holes that lie near each other. They first separate the holes into N parts based on their distance from each other. Then they calculate and select an appropriate sheet metal to cover each part.

Write a program to find the area of the smallest square that covers all the holes in a part.

Input

The first line contains a single integer N written in decimal without leading zeros, denoting the number of parts (test cases).

The following lines describe the number of holes in each part and their locations.

To make this clear, each test case begins with a single line containing a single integer N written in decimal without leading zeros, the number of holes that follow. Each of the following N lines contains two integers x and y, both written in decimal without leading zeros, giving the coordinates of one point.

  • N <= 30
  • -500 < x, y < 500

Output

Print the area of the smallest square containing all your points, on a single line with two decimal places of precision.

An answer is accepted if it lies within 0.1 of the correct answer.

Examples1

  1. Example 1

    Input
    2
    3
    -1 -1
    1 1
    1 2
    4
    5 2
    5 -2
    -5 2
    -5 -2
    
    Expected output
    6.50
    98.00