#include <bits/stdc++.h>
using namespace std;
long long x[105][105];
long long y[10003][2];
int main() {
  long long m, n, q;
  while (cin >> m >> n >> q) {
    memset(x, 0, sizeof(x));
    int flag;
    for (int number1 = 0; number1 < q; number1++) {
      cin >> flag;
      if (flag == 1) {
        y[number1][0] = flag;
        cin >> y[number1][1];
        long long pp = x[y[number1][1]][1];
        for (int number2 = 2; number2 <= n; number2++) {
          x[y[number1][1]][number2 - 1] = x[y[number1][1]][number2];
        }
        x[y[number1][1]][n] = pp;
      } else if (flag == 2) {
        y[number1][0] = flag;
        cin >> y[number1][1];
        long long pp = x[1][y[number1][1]];
        for (int number2 = 2; number2 <= m; number2++) {
          x[number2 - 1][y[number1][1]] = x[number2][y[number1][1]];
        }
        x[m][y[number1][1]] = pp;
      } else if (flag == 3) {
        y[number1][0] = flag;
        long long x1, y1, value;
        cin >> x1 >> y1 >> value;
        x[x1][y1] = value;
      }
    }
    for (int number1 = q - 1; number1 >= 0; number1--) {
      if (y[number1][0] == 1) {
        long long pp = x[y[number1][1]][n];
        for (int number2 = n; number2 >= 2; number2--) {
          x[y[number1][1]][number2] = x[y[number1][1]][number2 - 1];
        }
        x[y[number1][1]][1] = pp;
      } else if (y[number1][0] == 2) {
        long long pp = x[m][y[number1][1]];
        for (int number2 = m; number2 >= 2; number2--) {
          x[number2][y[number1][1]] = x[number2 - 1][y[number1][1]];
        }
        x[1][y[number1][1]] = pp;
      }
    }
    for (int number1 = 1; number1 <= m; number1++) {
      for (int number2 = 1; number2 <= n; number2++) {
        cout << x[number1][number2];
        if (number2 < n) cout << " ";
      }
      cout << endl;
    }
  }
}
