#include <bits/stdc++.h>
using namespace std;
int mat[101][101] = {0};
int n, m, q;
void shift_row(int rr) {
  int temp = mat[rr][m];
  for (int i = m; i > 1; --i) mat[rr][i] = mat[rr][i - 1];
  mat[rr][1] = temp;
}
void shift_col(int cc) {
  int temp = mat[n][cc];
  for (int i = n; i > 1; --i) mat[i][cc] = mat[i - 1][cc];
  mat[1][cc] = temp;
}
struct input {
  int t, r, c, x;
};
vector<input> vp;
int main() {
  cin >> n >> m >> q;
  memset(mat, 0, sizeof(mat));
  ;
  for (int Q = 0; Q < q; ++Q) {
    input I;
    scanf("%d", &I.t);
    if (I.t == 3) {
      scanf("%d %d %d", &I.r, &I.c, &I.x);
    } else if (I.t == 2) {
      scanf("%d", &I.c);
    } else {
      scanf("%d", &I.r);
    }
    vp.push_back(I);
  }
  for (int i = q - 1; i >= 0; --i) {
    if (vp[i].t == 1)
      shift_row(vp[i].r);
    else if (vp[i].t == 2)
      shift_col(vp[i].c);
    else
      mat[vp[i].r][vp[i].c] = vp[i].x;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      printf("%d ", mat[i][j]);
    }
    puts("");
  }
  return 0;
}
