Magnetic Games

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Vova has a magnet which is his favorite toy. Vova likes to play with it on a big field which can be represented as rectangle of nn cells height and mm cells width.

One day he came to the field with his magnet and lost it in one of the cells. Vova was frustrated, but found a solution --- he puts a compass in each cell of the field. Compass arrow may be oriented in one of the following 8 directions. Each direction has its own number:

Arrows take direction close to the direction to the magnet: if the magnet is strictly along the diagonal to the compass, arrow of this compass points diagonally, otherwise --- it points in the closest of the vertical and the horizontal direction to the magnet. Arrow of the compass in the cell with the magnet may be directed anywhere.

Illustration for the sample test, arrows of all compasses point to the magnet.

Vova was ready to start searching, but suddenly recalled that there is an anomaly at the field, that inverts compasses along one horizontal and one vertical line. Arrows of the comapasses in the anomaly zone point in the opposite direction to the correct one.

Illustration for the sample, readings of some of the compasses are inverted.

Now Vova doesn't know how to find his magnet and asks you for help.

입력

The first line of the input contains two integers nn and mm --- size of the field (2n,m1500,nm62 \le n, m \le 1500, nm \ge 6).

The following nn lines contain information about compasses on the field.

The ii-th line contains mm integers a_i,ja\_{i,j} (1a_i,j81 \le a\_{i,j} \le 8), the jj-th number on the ii-th line describes the direction of the compass arrow in the jj-th cell on the ii-th line.

출력

The first line of output should contain two integers xx and yy --- the row and the column of the cell where the magnet is.

The second line must contain two integers aa and bb --- which the horizontal and which vertical line are affected by the anomaly.

힌트

The magnet in sample input is in the cell (2,1)(2, 1), the anomaly inverts horizontal number 33 and vertical number 33.