#include <iostream>
using namespace std;
int mat[1001][1001];
int main() {
int n;
cin >> n;
int q; cin >> q;
while (q--) {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
mat[x1][y1]++;
mat[x2 + 1][y2 + 1]++;
mat[x1][y2 + 1]--;
mat[x2 + 1][y1]--;
}
for(int i=1;i<=n;i++,cout<<endl)
for (int j = 1; j <= n; j++) {
mat[i][j] += mat[i - 1][j] + mat[i][j - 1] - mat[i - 1][j - 1];
cout << mat[i][j] << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWF0WzEwMDFdWzEwMDFdOwppbnQgbWFpbigpIHsKaW50IG47CgljaW4gPj4gbjsKCWludCBxOyBjaW4gPj4gcTsKCXdoaWxlIChxLS0pIHsKCQlpbnQgeDEsIHkxLCB4MiwgeTI7CgkJY2luID4+IHgxID4+IHkxID4+IHgyID4+IHkyOwoJCW1hdFt4MV1beTFdKys7CgkJbWF0W3gyICsgMV1beTIgKyAxXSsrOwoJCW1hdFt4MV1beTIgKyAxXS0tOwoJCW1hdFt4MiArIDFdW3kxXS0tOwoJfQoJZm9yKGludCBpPTE7aTw9bjtpKyssY291dDw8ZW5kbCkKCQlmb3IgKGludCBqID0gMTsgaiA8PSBuOyBqKyspIHsKCQkJbWF0W2ldW2pdICs9IG1hdFtpIC0gMV1bal0gKyBtYXRbaV1baiAtIDFdIC0gbWF0W2kgLSAxXVtqIC0gMV07CgkJCWNvdXQgPDwgbWF0W2ldW2pdIDw8ICIgIjsKCQl9CgkJcmV0dXJuIDA7Cn0=