An N×M grid holds one number in every cell, and all of the numbers are different. Among the cells still on the board, cells that touch up, down, left, or right belong to the same XOR group, and the value of a group is the XOR of every number in it. A missing cell in between breaks the link, so one board can hold several XOR groups. The score of the board is the sum of the values of all XOR groups.
Every cell is on the board at the start. You then erase cells one at a time, always the cell holding the smallest number that is left. Each erasure changes the groups and the score. Print the largest score over the starting board before any erasure together with every board that follows an erasure.
Input
The first line has N and M. (1≤N,M≤1,000)
Each of the next N lines has the M numbers of row i of the grid, separated by spaces. Every number is an integer between 0 and 1,000,000, and all numbers in the grid are different.