#include <iostream>
using namespace std;

int main()
{
	int n = 0, a[120] = { 0 }, b = 0, f = 0, r = 0, v = 0, k = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		k = (b - 1) * 30 + (f - 1) * 10 + r - 1;
		a[k] += v;
	}

	for (int i = 0; i < 120; i++) {
		cout << " " << a[i];
		if ((i % 10) == 9)
			cout << endl;
		if ((i % 30) == 29 && i < 100)
			cout << "####################" << endl;
	}

    return 0;
}