#include <bits/stdc++.h>
using namespace std;
long long n, m, k, l, i, j, a, b, c, q, d[105][105], res[100005];
string s;
int main() {
  cin >> n >> m >> l;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      k++;
      d[i][j] = k;
    }
  }
  for (i = 0; i < l; i++) {
    cin >> q;
    if (q == 1) {
      cin >> k;
      a = d[k][1];
      for (j = 1; j <= m; j++) {
        d[k][j] = d[k][j + 1];
      }
      d[k][m] = a;
    }
    if (q == 2) {
      cin >> k;
      a = d[1][k];
      for (j = 1; j <= n; j++) {
        d[j][k] = d[j + 1][k];
      }
      d[n][k] = a;
    }
    if (q == 3) {
      cin >> a >> b >> c;
      res[d[a][b]] = c;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << res[i * m - m + j] << " ";
    }
    cout << endl;
  }
}
