#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using P = pair<int, int>;

int main(void) {
    
    //cin.tie(nullptr);ios::sync_with_stdio(false);cout << fixed << setprecision(20);

    ios::sync_with_stdio(false); cin.tie(0);

    int h, w;
    cin >> h >> w;

    int cntO = 0;

    VV<int> a(h, V<int>(w));
    rep (i, h) rep (j, w) {
        cin >> a[i][j];
        if (a[i][j] % 2) cntO++;
    }

    V<P> hozon;

    for (int i = 0; i < h; i++) {
        if (i % 2 == 0) {
            for (int j = 0; j < w; j++) {
                if (a[i][j] % 2) {
                    if (cntO % 2 == 1 && hozon.size() == cntO - 1) {
                        break;
                    }
                    hozon.eb(i, j);
                }
            }
        }
        else {
            for (int j = w - 1; j >= 0; j--) {
                if (a[i][j] % 2) {
                    if (cntO % 2 == 1 && hozon.size() == cntO - 1) {
                        break;
                    }
                    hozon.eb(i, j);
                }
            }
        }
    }



    int now = 0;
    int used = 0;

    V<P> ans;
    if (cntO % 2) cntO--;

    //cout << cntO << endl;

    int startX = 0, startY = 0;
    
    for (int i = 0; i < cntO; i += 2) {
        
        P mae = hozon[i], ushiro = hozon[i + 1];
        bool Bring = false;
        
        
        for (int j = startY; j < h; j++) {
            if (j % 2 == 0) {
                for (int k = 0; k < w; k++) {
                    if (mae.fi == j && mae.se == k) {
                        Bring = true;
                    }

                    if (Bring && (ushiro.fi != j || ushiro.se != k) ) {
                        ans.eb(j, k);
                    }
                    else if (Bring && ushiro.fi == j && ushiro.se == k) {
                        ans.eb(j, k);
                        ans.eb(-1, -1);
                        Bring = false;

                        startY = j;

                        k = w;
                        j = h;
                    }
                }
            }
            else {
                for (int k = w - 1; k >= 0; k--) {
                    if (mae.fi == j && mae.se == k) {
                        Bring = true;
                        
                    }

                    if (Bring && (ushiro.fi != j || ushiro.se != k) ) {
                        ans.eb(j, k);
                    }
                    else if (Bring && ushiro.fi == j && ushiro.se == k) {
                        ans.eb(j, k);
                        ans.eb(-1, -1);
                        Bring = false;

                        startY = j;

                        k = -1;
                        j = h;
                    }
                }
            }
        }
    }

    V<pair<P, P>> res; 

    
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i + 1].fi != -1) {
            res.eb(ans[i], ans[i + 1]);
        }
        else {
            i++;
        }
    }

    cout << res.size() << endl;
    rep (i, res.size()) cout << res[i].fi.fi+1 << " " << res[i].fi.se+1 
                            << " " << res[i].se.fi+1 << " " << res[i].se.se+1
                            << endl;
    
    return 0;
}


Measured memory_bytes: 12016