import java.util.Scanner

import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val H = sc.nextInt
    val W = sc.nextInt
    val a = ArrayBuffer.fill(H)(ArrayBuffer.fill(W)(sc.nextInt % 2 != 0))

    val result = new ArrayBuffer[String]()
    for (y <- 0 until H; x <- 0 until W) {
      if (a(y)(x)) {
        if (x < W - 1) {
          a(y)(x) = false
          a(y)(x + 1) = !a(y)(x + 1)
          result += "%d %d %d %d".format(y + 1, x + 1, y + 1, x + 2)
        } else if (y < H - 1) {
          a(y)(x) = false
          a(y + 1)(x) = !a(y + 1)(x)
          result += "%d %d %d %d".format(y + 1, x + 1, y + 2, x + 1)
        }
      }
    }

    result.mkString("\n")
  }
}
