Feather

No attempts yetTime limit1sMemory limit1024 MB

Problem

Bitlandija is a large rectangular island, divided into N×KN \times K unit squares called cells.

Every cell is either rock or plain. A plain cell may or may not carry wind. There are two kinds of wind:

  • Constant — it blows toward one of the four directions (North, East, South, West) at a speed of 11 m/s and never changes.
  • Whirlwind — it also blows at 11 m/s, but every second it turns one step clockwise (North \to East \to South \to West \to North). At the moment the feather is lost (second 00) each whirlwind points toward its own initial direction.

Passer domesticus — the famous house sparrow of Bitlandija — has lost a feather. It knows the cell the feather is currently on and wants to know where the feather will end up. Each second the feather is carried by the wind of the cell it is on:

  • If the wind blows toward an adjacent plain cell, the feather moves onto that neighbouring cell.
  • If the wind blows toward an adjacent rock cell, the feather stays hanging in place and does not move.
  • If the wind blows past the edge of the island, the feather is blown off the island.
  • If the feather is on a plain cell that has no wind, nothing pushes it, so it settles and lands there.

Given the feather's starting cell, determine its fate:

  1. Will it never land?
  2. Will it eventually land? If so, on which cell?
  3. Will it be blown off the island? If so, which was the last island cell it occupied?

Input

The first line contains the island width NN and length KK.

The next KK lines each contain NN integers describing every cell of the island:

  • 00 — plain cell with no wind.
  • 11 — plain cell with a constant wind blowing toward the North.
  • 22 — plain cell with a constant wind blowing toward the East.
  • 33 — plain cell with a constant wind blowing toward the South.
  • 44 — plain cell with a constant wind blowing toward the West.
  • 55 — plain cell with a whirlwind whose initial direction is North.
  • 66 — plain cell with a whirlwind whose initial direction is East.
  • 77 — plain cell with a whirlwind whose initial direction is South.
  • 88 — plain cell with a whirlwind whose initial direction is West.
  • 99 — rock.

The last line contains two integers xx and yy — the feather's starting coordinates (1xN1 \le x \le N, 1yK1 \le y \le K). The starting cell is never rock.

Important: the map is listed with the coordinate yy decreasing, that is y=K,K1,,1y = K, K-1, \ldots, 1. Within each row the values are given for x=1,2,,Nx = 1, 2, \ldots, N from left to right. The bottom-left cell has coordinates (1,1)(1, 1) and lies to the South-West; the top-right cell has coordinates (N,K)(N, K) and lies to the North-East.

Output

Print the answer in the following format:

  1. If the feather never lands, print the number 00.
  2. If the feather stops and lands, print 11 on the first line and the coordinates x1 y1x_1\ y_1 of the landing cell on the second line.
  3. If the feather is blown off the island, print 22 on the first line and the coordinates x2 y2x_2\ y_2 of the last island cell it occupied on the second line.

Constraints

  • 1N,K10001 \le N, K \le 1000