{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Mr. F. wants to get a document be signed by a minister. A minister signs a document only if it is approved by his ministry. The ministry is an M-floor building with floors numbered from 1 to M, 1\u0026lt;\u003dM\u0026lt;\u003d100. Each floor has N rooms (1\u0026lt;\u003dN\u0026lt;\u003d500) also numbered from 1 to N. In each room there is one (and only one) official. \r\u003cbr\u003e\r\u003cbr\u003eA document is approved by the ministry only if it is signed by at least one official from the M-th floor. An official signs a document only if at least one of the following conditions is satisfied: \r\u003cbr\u003e\u003cblockquote\u003ea. the official works on the 1st floor; \r\u003cbr\u003eb. the document is signed by the official working in the room with the same number but situated one floor below; \r\u003cbr\u003ec. the document is signed by an official working in a neighbouring room (rooms are neighbouring if they are situated on the same floor and their numbers differ by one). \u003c/blockquote\u003e\r\u003cbr\u003eEach official collects a fee for signing a document. The fee is a positive integer not exceeding 10^9. \r\u003cbr\u003e\r\u003cbr\u003eYou should find the cheapest way to approve the document. \r\u003cbr\u003e\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of an input file contains two integers, separated by space. The first integer M represents the number of floors in the building, and the second integer N represents the number of rooms per floor. Each of the next M lines contains N integers separated with spaces that describe fees (the k-th integer at l-th line is the fee required by the official working in the k-th room at the l-th floor). "}},{"title":"Output","value":{"format":"HTML","content":"You should print the numbers of rooms (one per line) in the order they should be visited to approve the document in the cheapest way. If there are more than one way leading to the cheapest cost you may print an any of them. "}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 4\r\n10 10 1 10\r\n2 2 2 10\r\n1 10 10 10\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n3\r\n2\r\n1\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"You can assume that for each official there always exists a way to get the approval of a document (from the 1st floor to this official inclusively) paying no more than 10^9. \r\u003cbr\u003eThis problem has huge input data,use scanf() instead of cin to read data to avoid time limit exceed."}}]}