import java.util.*;
import java.io.*;
import java.math.*;
class Player
{
public static void main
(String args
[]) {
Scanner in
= new Scanner
(System.
in);
short width = in.nextShort(); // the number of cells on the X axis
short height = in.nextShort(); // the number of cells on the Y axis
if (in.hasNextLine()) {
in.nextLine();
}
for(short y = 0; y < height; ++y)
{
node[y] = in.nextLine();
}
for(short y = 0; y < height; ++y)
{
for(short x = 0; x < width; ++x)
{
if (node[y].charAt(x) == '0')
{
short x2, y2, ansX = -1, ansY = -1;
for (x2 = (short)(x+1); x2 < width; ++x2)
{
if (node[y].charAt(x2) == '0')
{
ansX = x2;
ansY = y;
break;
}
}
out.
printf(String.
valueOf(ansX
)+" "+String.
valueOf(ansY
)+" "); ansX = -1;
ansY = -1;
for(y2 = (short)(y+1); y2 < height; ++y2)
{
if (node[y2].charAt(x) == '0')
{
ansX = x;
ansY = y2;
break;
}
}
out.
printf(String.
valueOf(ansX
)+" "+String.
valueOf(ansY
)+"\n"); x = (short)(x2-1);
}
}
}
out.flush();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS5tYXRoLio7CgpjbGFzcyBQbGF5ZXIKewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nIGFyZ3NbXSkKICAgIHsKICAgICAgICBTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgICAgICBQcmludFdyaXRlciBvdXQgPSBuZXcgUHJpbnRXcml0ZXIoU3lzdGVtLm91dCk7CiAgICAgICAgCiAgICAgICAgc2hvcnQgd2lkdGggPSBpbi5uZXh0U2hvcnQoKTsgLy8gdGhlIG51bWJlciBvZiBjZWxscyBvbiB0aGUgWCBheGlzCiAgICAgICAgc2hvcnQgaGVpZ2h0ID0gaW4ubmV4dFNob3J0KCk7IC8vIHRoZSBudW1iZXIgb2YgY2VsbHMgb24gdGhlIFkgYXhpcwogICAgICAgIAogICAgICAgIGlmIChpbi5oYXNOZXh0TGluZSgpKSB7CiAgICAgICAgICAgIGluLm5leHRMaW5lKCk7CiAgICAgICAgfQoKICAgICAgICBTdHJpbmcgbm9kZVtdID0gbmV3IFN0cmluZ1toZWlnaHRdOwogICAgICAgIAogICAgICAgIGZvcihzaG9ydCB5ID0gMDsgeSA8IGhlaWdodDsgKyt5KQogICAgICAgIHsKICAgICAgICAgICAgbm9kZVt5XSA9IGluLm5leHRMaW5lKCk7CiAgICAgICAgfQogICAgICAgIAogICAgICAgIGZvcihzaG9ydCB5ID0gMDsgeSA8IGhlaWdodDsgKyt5KQogICAgICAgIHsKICAgICAgICAgICAgZm9yKHNob3J0IHggPSAwOyB4IDwgd2lkdGg7ICsreCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5vZGVbeV0uY2hhckF0KHgpID09ICcwJykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBvdXQucHJpbnRmKFN0cmluZy52YWx1ZU9mKHgpKyIgIitTdHJpbmcudmFsdWVPZih5KSsiICIpOwogICAgICAgICAgICAgICAgICAgIHNob3J0IHgyLCB5MiwgYW5zWCA9IC0xLCBhbnNZID0gLTE7CiAgICAgICAgICAgICAgICAgICAgZm9yICh4MiA9IChzaG9ydCkoeCsxKTsgeDIgPCB3aWR0aDsgKyt4MikKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChub2RlW3ldLmNoYXJBdCh4MikgPT0gJzAnKQogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnNYID0geDI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbnNZID0geTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG91dC5wcmludGYoU3RyaW5nLnZhbHVlT2YoYW5zWCkrIiAiK1N0cmluZy52YWx1ZU9mKGFuc1kpKyIgIik7CiAgICAgICAgICAgICAgICAgICAgYW5zWCA9IC0xOwogICAgICAgICAgICAgICAgICAgIGFuc1kgPSAtMTsKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICBmb3IoeTIgPSAoc2hvcnQpKHkrMSk7IHkyIDwgaGVpZ2h0OyArK3kyKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGVbeTJdLmNoYXJBdCh4KSA9PSAnMCcpCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuc1ggPSB4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5zWSA9IHkyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgb3V0LnByaW50ZihTdHJpbmcudmFsdWVPZihhbnNYKSsiICIrU3RyaW5nLnZhbHVlT2YoYW5zWSkrIlxuIik7CiAgICAgICAgICAgICAgICAgICAgeCA9IChzaG9ydCkoeDItMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgb3V0LmZsdXNoKCk7CiAgICB9Cn0=