#include <bits/stdc++.h>
using namespace std;
const int N = 105, M = 10005;
int n, m, q;
int g[N][N];
bool has[N][N];
int qt[M], qr[M], qc[M], qx[M];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; ++i) {
    scanf("%d", qt + i);
    if (qt[i] == 1)
      scanf("%d", qr + i);
    else if (qt[i] == 2)
      scanf("%d", qc + i);
    else
      scanf("%d%d%d", qr + i, qc + i, qx + i);
  }
  for (int i = (q)-1; i >= 0; --i) {
    if (qt[i] == 1) {
      int r = qr[i] - 1;
      for (int j = (m)-1; j >= 1; --j) {
        swap(g[r][j], g[r][j - 1]);
        swap(has[r][j], has[r][j - 1]);
      }
    } else if (qt[i] == 2) {
      int c = qc[i] - 1;
      for (int j = (n)-1; j >= 1; --j) {
        swap(g[j][c], g[j - 1][c]);
        swap(has[j][c], has[j - 1][c]);
      }
    } else {
      int r = qr[i] - 1;
      int c = qc[i] - 1;
      has[r][c] = true;
      g[r][c] = qx[i];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (j) printf(" ");
      printf("%d", g[i][j]);
    }
    printf("\n");
  }
}
