Organization

Partition N points into k nonempty teams so that the minimum Manhattan distance between points in different teams is as large as possible.

Medium7Binary searchSortingGeometryNo attempts yetTime limit2sMemory limit512 MB

Problem

A company has NN employees and splits them into kk nonempty teams. The company turns everything into numbers.

  • Employee aa took two tests and got two values xax_a and yay_a.
  • The difference between employees aa and bb is D(a,b)=xaxb+yaybD(a, b) = |x_a - x_b| + |y_a - y_b|.
  • The strength index SISI of the company is the smallest D(a,b)D(a, b) over all pairs of employees aa, bb that sit in different teams.

Next year the company keeps kk teams and rearranges the employees so that the strength index is as large as possible. Compute the largest strength index that kk nonempty teams can reach.

Input

The first line contains the number of test cases TT. (1T101 \le T \le 10)

The first line of each test case contains the number of employees NN and the number of teams kk, separated by a single space. (2k102 \le k \le 10, kN1000k \le N \le 1000)

Each of the next NN lines contains the two test results xx and yy of one employee, separated by a single space. (0x,y1000000 \le x, y \le 100\,000)

Output

For each test case, print the largest strength index on its own line.

Hint

Take the three employees (0,0)(0, 0), (2,2)(2, 2), (3,2)(3, 2) with k=2k = 2. Neither team may be empty, so there are three ways to split them. {(0,0)}\{(0,0)\} with {(2,2),(3,2)}\{(2,2), (3,2)\} gives SI=min{4,5}=4SI = \min\{4, 5\} = 4, {(0,0),(2,2)}\{(0,0), (2,2)\} with {(3,2)}\{(3,2)\} gives SI=min{5,1}=1SI = \min\{5, 1\} = 1, and {(0,0),(3,2)}\{(0,0), (3,2)\} with {(2,2)}\{(2,2)\} gives SI=min{5,1}=1SI = \min\{5, 1\} = 1. The largest value is 44.

Take the six employees (0,1)(0,1), (0,0)(0,0), (1,0)(1,0), (2,2)(2,2), (2,3)(2,3), (3,2)(3,2) with k=2k = 2. There are 31 ways to split them, and {(0,1),(0,0),(1,0)}\{(0,1), (0,0), (1,0)\} with {(2,2),(2,3),(3,2)}\{(2,2), (2,3), (3,2)\} reaches the largest value SI=3SI = 3. That value comes from D((0,1),(2,2))D((0,1), (2,2)) and from D((1,0),(2,2))D((1,0), (2,2)).