Thanks to Max's invaluable leadership, a sizable portion of the ex-convicts are still alive and mentally stable! But before they can return home to their families, Joey orders them to exterminate the bebiliths, even if it costs them their lives!
The bebiliths pour out of the cave, aligned in
After every strategic offense from the ex-convicts, Joey wants to evaluate the enemy's condition by finding the strength of the weakest column of bebiliths for all the columns in
Input Specification
The first line will contain
The second line will contain
The next
Output Specification
For every strategic offense, print out the number of bebiliths in the weakest column in the range of columns
Sample Input
3 3
4 4 4
1 1 3
2 3 2
1 3 7
Sample Output
1 1
2 1
0 0
Comments