#NPC2014H. Arithmetic Rectangle

Arithmetic Rectangle

There is a matrix with size N x M where each cell contains an integer. An arithmetic rectangle is a rectangle inside the matrix so that each row and column is an arithmetic progression. An arithmetic progression is a sequence so that each number minus the number before it is the same. Given a matrix, find the largest arithmetic rectangle, which is the arithmetic rectangle containing the most number of cells. For example, the largest arithmetic rectangles of the matrix below consists of 9 cells:

5,3,5,7/2,4,4,4/3,5,3,1/6,3,2,4

Input

First line of input is T, the number of test cases. Each test case starts with N and M. The next N lines each containing M integers  Aij representing the value of each cell of the matrix. Each input file will not exceed 20 MB in size.

Output

For each test case output the number of cells in the largest arithmetic rectangle in the matrix.

Sample Input

2
4 4
5 3 5 7
2 4 4 4
3 5 3 1
6 3 2 4
2 3
0 1 2
1 2 3

Sample Output

9
6

Constraint

  • 1 ≤ T ≤ 10000
  • 1 ≤ N, M ≤ 3000
  • 0 ≤ Aij ≤ 1000000000

Input file is huge, is faster I/O (scanf for C)