#include <bits/stdc++.h>
using namespace std;
int n, m, q;
struct matrix {
  int val;
} matr[109][109];
matrix* mat[109][109];
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      matr[i][j].val = 0;
      mat[i][j] = &matr[i][j];
    }
  int t1, t2, t3, t4, t5;
  matrix* tmp;
  for (int i = 0; i < q; i++) {
    scanf("%d", &t1);
    if (t1 == 1) {
      scanf("%d", &t2);
      tmp = mat[t2][1];
      for (int j = 1; j < m; j++) {
        mat[t2][j] = mat[t2][j + 1];
      }
      mat[t2][m] = tmp;
    } else if (t1 == 2) {
      scanf("%d", &t2);
      tmp = mat[1][t2];
      for (int i = 1; i < n; i++) {
        mat[i][t2] = mat[i + 1][t2];
      }
      mat[n][t2] = tmp;
    } else if (t1 == 3) {
      scanf("%d %d %d", &t3, &t4, &t5);
      mat[t3][t4]->val = t5;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", matr[i][j].val);
    }
    printf("\n");
  }
  return 0;
}
