Herding Sheep

No attempts yetTime limit2sMemory limit256 MB

Problem

Elly and her herd of sheep are in trouble again. After a whole day of grazing the sheep have to go into the barns so that they are safe for the night. One barn holds at most KK sheep. A barn does not have to be full and may stay empty. All that matters is that every sheep ends up inside some barn.

To keep things simple, the sheep are NN points and the barns are MM points with integer coordinates on the plane. Several sheep may share the same coordinates, several barns may share the same coordinates, and a sheep and a barn may share the same coordinates.

A sheep walks one unit of distance per second. A sheep at (0,0)(0, 0) that walks to a barn at (1,3)(1, 3) needs about 3.16227766 seconds, and a barn at (3,4)(3, 4) takes exactly 5 seconds. All sheep move at the same time and never block each other.

Compute the minimum time needed for all sheep to be inside barns. In other words, minimize the largest walking time over all sheep.

Input

The first line contains one integer TT, the number of test cases.

Each test case begins with three integers NN, MM and KK: the number of sheep, the number of barns, and the maximum number of sheep in one barn.

The next NN lines each contain two integers XX and YY, the coordinates of a sheep.

The next MM lines each contain two integers XX and YY, the coordinates of a barn.

  • 1T201 \le T \le 20
  • 1N,M,K2001 \le N, M, K \le 200
  • 1000X,Y1000-1000 \le X, Y \le 1000
  • NM×KN \le M \times K

Output

For each test case, print the square of the minimum time as an integer on its own line. All coordinates are integers, so the square of the minimum time is always an integer. If the minimum time is 5 seconds, print 25.