/**
 *    author:  orzvanh14 ( Độc cô cầu đặc )
 *    created: 18.04.2026 03:56:02
 *    too lazy to update time
**/
// i wants to take ioi
//binhtinhtutinkhongcaycunhungmotkhikhongcontutinnualatuyetvong
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define nn "\n"
#define pi pair<int, int>
#define ti tuple<int, int, int>
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define eb emplace_back
#define pb push_back
#define TASK " "

#define ms(a, x) memset(a, x, sizeof(a))
#define all(a) a.begin(), a.end()
#define All(a, n) a + 1, a + 1 + n

#define LOG 19

const int INF = 1e18;
const int N = 1e2 + 5;
const int maxn = 100 + 5;
const int mod = 1e9 + 7;


struct node{
	int kc, u;
	bool operator<(const node& other) const {
        return kc > other.kc;
    }
};
struct edge{
	int u, v, w;
};
int n, m;
int sz[N][N];
pi par[N][N];
int dx[] = {0, 0 , -1, 1};
int dy[] = {1, -1, 0, 0};
struct kq{
    int u1, v1, u2, v2;
};
vector<kq> ans;
void make_sets(int s, int y){
    sz[s][y] = 1;
    par[s][y] = {s, y};
}
pi get(int a, int A){
    if(make_pair(a, A) == par[a][A]) return {a, A};
    return par[a][A] = get(par[a][A].fi, par[a][A].se);
}
void union_sets(int a, int A, int b, int B){
    auto [ra, rA] = get(a, A);
    auto [rb, rB] = get(b, B);
    if(ra != rb || rA != rB){
        if(sz[ra][rA] < sz[rb][rB]){
            // sz[a] > sz[b]
            swap(ra, rb);
            swap(rA, rB);
        }
        sz[ra][rA] += sz[rb][rB];
        par[rb][rB] = {ra, rA};
    }
}
void nhap(){
	cin >> m >> n;
	for(int i = 0; i <= m; i++){
        for(int j = 0; j <= n; j++){
            make_sets(i, j);
        }
	}
	int x1, y1, x2, y2;
	while(cin >> x1 >> y1 >> x2 >> y2){
        union_sets(x1, y1, x2, y2);
	}

}
void solve(){
	for(int i = 0; i <= m; i++){
        for(int j = 0; j <= n; j++){
            auto [u, v] = get(i, j);
            for(int k = 0; k < 4; k++){
                int x = i + dx[k];
                int y = j + dy[k];
                if(x <= m && y <= n && x >= 0 && y >= 0){
                    auto [U, V] = get(x, y);
                    if(u != U || v  != V){
                        union_sets(u, v, x, y);
                        ans.pb({i, j, x, y});
                    }
                }
            }
        }
	}
	cout << ans.size() << nn;
	for(int i = 0; i < ans.size(); i++){
        cout << ans[i].u1 << " " << ans[i].v1 << " " << ans[i].u2 << " " << ans[i].v2 << nn;
	}
}
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	nhap();
	solve();
	return 0;
}
