#include <bits/stdc++.h>
using namespace std;
int n, m, q, a[105][105], b[105][105], c[105][105];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      b[i][j] = i;
      c[i][j] = j;
    }
  while (q--) {
    int typ, R, C, x;
    scanf("%d", &typ);
    if (typ == 1) {
      scanf("%d", &R);
      int nb = b[R][1], nc = c[R][1];
      for (int i = 1; i < m; i++) {
        b[R][i] = b[R][i + 1];
        c[R][i] = c[R][i + 1];
      }
      b[R][m] = nb;
      c[R][m] = nc;
    } else if (typ == 2) {
      scanf("%d", &C);
      int nb = b[1][C], nc = c[1][C];
      for (int i = 1; i < n; i++) {
        b[i][C] = b[i + 1][C];
        c[i][C] = c[i + 1][C];
      }
      b[n][C] = nb;
      c[n][C] = nc;
    } else {
      scanf("%d%d%d", &R, &C, &x);
      a[b[R][C]][c[R][C]] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", a[i][j]);
    printf("\n");
  }
  return 0;
}
