Guard dog

Find an integer lattice point on a square roof where a chain can be anchored so it reaches every hatch center without leaving the roof, choosing the smallest coordinates.

Medium6GeometryBrute forceImplementationMathNo attempts yetTime limit1sMemory limit64 MB

Problem

A company owns an office building downtown. The roof of the building is flat and square. Several hatches are cut into the roof, and they turned out to be a serious security problem. Over the past month the building was broken into several times, and the burglars came in through the roof hatches every time.

The company therefore decided to keep a guard dog on the roof so that nobody gets in through a hatch. The local pet shop tricked the company into taking a very clumsy dog, and on its first visit to the roof the dog came close to falling off the building several times.

So the company decided to keep the dog on a chain, under these conditions:

  • The chain is anchored at a point with integer coordinates. If the roof is a square 10 meters on a side, its southwest corner is at (0,0)(0, 0) and its northeast corner is at (10,10)(10, 10).
  • The dog cannot fall off the building, but it may reach the very edge of the roof.
  • The dog can reach the center of every hatch.
  • The chain cannot be anchored at a point that is the center of a hatch.

You choose the length of the chain freely. If the length is LL, the dog roams over every point whose distance from the anchor is at most LL.

Find the coordinates of a point on the roof where the chain can be anchored.

Input

The first line contains a natural number N100N \le 100, the number of test cases.

The NN test cases follow. The first line of each test case contains two integers SS and HH separated by one space. SS is even and 2S402 \le S \le 40, and 1H501 \le H \le 50. SS is the side length of the roof in meters, and HH is the number of hatches on the roof.

The next HH lines contain two integers XX and YY each, the coordinates of the center of the corresponding hatch. A hatch center always lies strictly inside the roof, never on its boundary. No two hatches overlap.

Output

For each test case, print one line with the coordinates XX and YY of the anchor point, separated by one space. The point must satisfy every condition in the statement. If several such points exist, print the one with the smallest XX coordinate; if several still remain, print the one among them with the smallest YY coordinate.

If no such point exists, print -1 -1 as the answer for that test case.