#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-10;
const int oo = 1e9;
const int M = 1e6;
const int N = 1003;
int a[M][4];
int g[N][N];
int main() {
  if (0) {
    freopen("input.txt", "w", stdout);
    srand(time(NULL));
    return 0;
  }
  int i, j, n, m, q, t, u;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 0; i < q; ++i) {
    scanf("%d%d", &a[i][0], &a[i][1]);
    --a[i][1];
    if (a[i][0] == 3) {
      scanf("%d%d", &a[i][2], &a[i][3]);
      --a[i][2];
    }
  }
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j) g[i][j] = 0;
  for (u = q - 1; u >= 0; --u) {
    i = a[u][1];
    j = a[u][2];
    if (a[u][0] == 3)
      g[i][j] = a[u][3];
    else {
      if (a[u][0] == 1) {
        i = a[u][1];
        t = g[i][m - 1];
        for (j = m - 1; j > 0; --j) g[i][j] = g[i][j - 1];
        g[i][0] = t;
      } else {
        j = a[u][1];
        t = g[n - 1][j];
        for (i = n - 1; i > 0; --i) g[i][j] = g[i - 1][j];
        g[0][j] = t;
      }
    }
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) printf("%d ", g[i][j]);
    printf("\n");
  }
  return 0;
}
