#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	int H, W; cin >> H >> W;
	vector<vector<int> > D(H, vector<int>(W));
	for (int y = 0; y < H; y++)
		for (int x = 0; x < W; x++)
			scanf("%d", &D[y][x]);
	vector<vector<int> > a(H, vector<int>(W));
	for (int y = 0; y < H; y++)
		for (int x = 0; x < W; x++) {
			if (!D[y][x]) continue;
			a[y + 1][x + 1] = D[y][x];
			for (int dy = 0; dy < 3; dy++)
				for (int dx = 0; dx < 3; dx++)
					D[y + dy][x + dx] -= a[y + 1][x + 1];
		}
	set<i_i> s;
	for (int y = 0; y < H; y++)
		for (int x = 0; x < W; x++) {
			if (!a[y][x]) continue;
			int cnt = 0;
			for (int dy = -1; dy <= 1; dy++)
				for (int dx = -1; dx <= 1; dx++)
					cnt += a[y + dy][x + dx];
			if (cnt <= 2 || a[y][x] >= 2)
				s.insert(i_i(y, x));
		}
	vector<i_i> v(s.begin(), s.end());
	cout << v[v.size() - 1].first << ' ';
	cout << v[v.size() - 1].second << ' ';
	cout << v[0].first << ' ';
	cout << v[0].second << endl;
}