#include <bits/stdc++.h>
using namespace std;
int mat[105][105];
struct node {
  int t, x, y, col;
} opt[105 * 105];
int n, m;
void output() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", mat[i][j]);
    }
    printf("\n");
  }
}
int main() {
  int q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &opt[i].t);
    if (opt[i].t == 3) {
      scanf("%d %d %d", &opt[i].x, &opt[i].y, &opt[i].col);
    } else {
      scanf("%d", &opt[i].col);
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (opt[i].t == 3) {
      mat[opt[i].x][opt[i].y] = opt[i].col;
    } else if (opt[i].t == 1) {
      int tmp = mat[opt[i].col][m];
      for (int j = m; j >= 2; j--) {
        mat[opt[i].col][j] = mat[opt[i].col][j - 1];
      }
      mat[opt[i].col][1] = tmp;
    } else {
      int tmp = mat[n][opt[i].col];
      for (int j = n; j >= 2; j--) {
        mat[j][opt[i].col] = mat[j - 1][opt[i].col];
      }
      mat[1][opt[i].col] = tmp;
    }
  }
  output();
}
