#include <bits/stdc++.h>
using namespace std;
int a[105][105], vt[100005], b[100005], x[100005], y[100005], d[100005];
int nhang, ncot, q;
void solve() {
  int i, j;
  int r, c, tg;
  for (i = 1; i <= nhang; i++)
    for (j = 1; j <= ncot; j++) a[i][j] = 0;
  for (i = 1; i <= q; i++) {
    scanf("%d", &vt[i]);
    if (vt[i] == 3)
      scanf("%d %d %d", &x[i], &y[i], &d[i]);
    else
      scanf("%d", &b[i]);
  }
  for (i = q; i >= 1; i--) {
    if (vt[i] == 1) {
      r = b[i];
      tg = a[r][ncot];
      for (j = ncot; j > 1; j--) a[r][j] = a[r][j - 1];
      a[r][1] = tg;
    }
    if (vt[i] == 2) {
      c = b[i];
      tg = a[nhang][c];
      for (j = nhang; j > 1; j--) a[j][c] = a[j - 1][c];
      a[1][c] = tg;
    }
    if (vt[i] == 3) a[x[i]][y[i]] = d[i];
  }
  for (i = 1; i <= nhang; i++) {
    for (j = 1; j < ncot; j++) printf("%d ", a[i][j]);
    printf("%d\n", a[i][j]);
  }
}
int main() {
  while (scanf("%d %d %d", &nhang, &ncot, &q) > 0) solve();
  return 0;
}
