#include <bits/stdc++.h>
int main() {
  int n, m, q;
  int tmp;
  int tmp2;
  int tmp3;
  int count;
  int *mov;
  int *col;
  int mat[100][100];
  scanf("%d %d %d", &n, &m, &q);
  mov = (int *)calloc(q, sizeof(int));
  count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      mat[i][j] = 0;
    }
  }
  for (int i = 0; i < q; i++) {
    tmp = getchar();
    tmp = getchar();
    if (tmp == 49) {
      scanf("%d", &tmp);
      mov[count] = tmp;
      count++;
    } else if (tmp == 50) {
      scanf("%d", &tmp);
      mov[count] = -tmp;
      count++;
    } else {
      scanf("%d %d %d", &tmp, &tmp2, &tmp3);
      for (int j = count - 1; j >= 0; j--) {
        if (mov[j] > 0) {
          if (tmp == mov[j]) {
            tmp2++;
            if (tmp2 > m) tmp2 = 1;
          }
        } else {
          if (tmp2 == (-1) * mov[j]) {
            tmp++;
            if (tmp > n) tmp = 1;
          }
        }
      }
      mat[tmp - 1][tmp2 - 1] = tmp3;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}
