You are given matrix *a* of size *n* × *m*, its elements are integers. We will assume that the rows of the matrix are numbered from top to bottom from 1 to *n*, the columns are numbered from left to right from 1 to *m*. We will denote the element on the intersecting of the *i*-th row and the *j*-th column as *a*<sub class="lower-index">*ij*</sub>.

We'll call submatrix *i*<sub class="lower-index">1</sub>, *j*<sub class="lower-index">1</sub>, *i*<sub class="lower-index">2</sub>, *j*<sub class="lower-index">2</sub> (1 ≤ *i*<sub class="lower-index">1</sub> ≤ *i*<sub class="lower-index">2</sub> ≤ *n*; 1 ≤ *j*<sub class="lower-index">1</sub> ≤ *j*<sub class="lower-index">2</sub> ≤ *m*) such elements *a*<sub class="lower-index">*ij*</sub> of the given matrix that *i*<sub class="lower-index">1</sub> ≤ *i* ≤ *i*<sub class="lower-index">2</sub> AND *j*<sub class="lower-index">1</sub> ≤ *j* ≤ *j*<sub class="lower-index">2</sub>. We'll call the area of the submatrix number (*i*<sub class="lower-index">2</sub> - *i*<sub class="lower-index">1</sub> + 1)·(*j*<sub class="lower-index">2</sub> - *j*<sub class="lower-index">1</sub> + 1). We'll call a submatrix inhomogeneous, if all its elements are distinct.

Find the largest (in area) inhomogenous submatrix of the given matrix.
The first line contains two integers *n*, *m* (1 ≤ *n*, *m* ≤ 400) — the number of rows and columns of the matrix, correspondingly.

Each of the next *n* lines contains *m* integers *a*<sub class="lower-index">*ij*</sub> (1 ≤ *a*<sub class="lower-index">*ij*</sub> ≤ 160000) — the elements of the matrix.
# O(n^3)

N, M = (int(i) for i in input().split())
matrix = [[0] * (M + 1) for i in range(N + 1)]
for i in range(1, N + 1):
    row = (int(n) for n in input().split())
    for j, n in enumerate(row,1):
        matrix[i][j] = n

num_to_column = [{} for i in range(N+1)]
left_bound = [[0]*(N+2) for i in range(N+2)]
maximum = 0


for column in range(1, M+1):
    for up in range(N, 0, -1):
        for down in range(up, N+1):
            if up != down and matrix[up][column] == matrix[down][column]:
                left_bound[up][down] = column
            left_bound_tmp1 = max(num_to_column[down].get(matrix[up][column],0), left_bound[up][down-1])
            left_bound_tmp2 = max(num_to_column[up].get(matrix[down][column],0), left_bound[up+1][down])
            left_bound[up][down] = max(left_bound[up][down], left_bound_tmp1, left_bound_tmp2)

            maximum = max(maximum, (down-up+1)*(column - left_bound[up][down]))
    for row in range(1,N+1):
        num_to_column[row][matrix[row][column]] = column

print(maximum)