You are given two matrices, and the elements of each matrix are ranged from to and pairwise distinct. You need to find the common submatrix with the largest size between these two matrices.
Example:
Matrix :
Matrix :
Largest common submatrix:
输入格式
The first line of input contains two integers and , denoting the number of rows and columns of each matrix.
Each of the next lines contain integers per line, denoting the first matrix . And again, each of the next lines contains integers per line, denoting the second matrix .
It is guaranteed that , and always holds for each pair of and , where .
输出格式
Output an integer representing the size of the largest common submatrix.