#include <bits/stdc++.h>
using namespace std;
int mat[110][110];
int n, m, q;
void cr(int k) {
  int t = mat[k][m];
  for (int i = m; i >= 2; i--) mat[k][i] = mat[k][i - 1];
  mat[k][1] = t;
}
void cc(int k) {
  int t = mat[n][k];
  for (int i = n; i >= 2; i--) mat[i][k] = mat[i - 1][k];
  mat[1][k] = t;
}
void print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << mat[i][j] << " ";
    cout << endl;
  }
}
struct com {
  int t;
  int r, c;
  int x;
} Q[(int)1e4 + 5];
int main() {
  while (cin >> n >> m >> q) {
    memset(mat, 0, sizeof(mat));
    for (int i = 0; i < q; i++) {
      int t;
      cin >> t;
      Q[i].t = t;
      if (t == 1)
        cin >> Q[i].r;
      else if (t == 2)
        cin >> Q[i].c;
      else
        cin >> Q[i].r >> Q[i].c >> Q[i].x;
    }
    for (int i = q - 1; i >= 0; i--) {
      int t = Q[i].t;
      if (t == 1)
        cr(Q[i].r);
      else if (t == 2)
        cc(Q[i].c);
      else
        mat[Q[i].r][Q[i].c] = Q[i].x;
    }
    print();
  }
  return 0;
}
