#include <bits/stdc++.h>
using namespace std;
long long a[1005][1005];
long long n, m, x, y, x2,y2;
int main()
{
cin >> n >> m;
while (n--){
cin >> x >> y >> x2 >> y2;
for (int i = x; i <= x2; i++)
a[i][y]++, a[i][y2 + 1]--;
}
for (int i = 1; i <= m; i++){
for (int j = 1; j <= m; j++){
a[i][j] += a[i][j - 1];
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}