In a village named CodeVillage, there lived a rich landlord named Digo. Digo owns large tracts of land which are arranged in the form of a mXn matrix. Digo has assigned different numbers to each farm. Every morning he goes on a walk of his property with his wife. One particular day his wife insisted on taking a particular path while moving through the farms ie the path is 11,21,34,64,91,82,74,45,54. You have to print the path Digo takes with his wife.
11 21 34
45 54 64
74 82 91
First line contain m and n separated by space which gives the size of the array.
m*n lines follow, each having one integer 'x' which gives the farm number.
m*n lines, stating the farm-number in the order they are visited
3 3 //size of matrix
11 //first element of matrix