#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 10005;
int G[110][110];
int w[maxn], r[maxn], c[maxn], r1[maxn], c1[maxn], x1[maxn];
int main() {
  int n, m, q;
  memset(G, 0, sizeof(G));
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &w[i]);
    if (w[i] == 1)
      scanf("%d", &r[i]);
    else if (w[i] == 2)
      scanf("%d", &c[i]);
    else {
      scanf("%d%d%d", &r1[i], &c1[i], &x1[i]);
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (w[i] == 1) {
      int r0 = r[i];
      int t = G[r0][m];
      for (int j = m; j > 1; j--) {
        G[r0][j] = G[r0][j - 1];
      }
      G[r0][1] = t;
    } else if (w[i] == 2) {
      int c0 = c[i];
      int t = G[n][c0];
      for (int j = n; j > 1; j--) {
        G[j][c0] = G[j - 1][c0];
      }
      G[1][c0] = t;
    } else {
      G[r1[i]][c1[i]] = x1[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < m; j++) {
      printf("%d ", G[i][j]);
    }
    printf("%d\n", G[i][m]);
  }
  return 0;
}
