#include <bits/stdc++.h>
using namespace std;
const int L = (int)1e4 + 5;
int IN[L][4], N, M, A[105][105];
void shift_right(int x) {
  int temp = A[x][M];
  for (int i = M; i > 1; --i) A[x][i] = A[x][i - 1];
  A[x][1] = temp;
}
void shift_bottom(int x) {
  int temp = A[N][x];
  for (int i = N; i > 1; --i) A[i][x] = A[i - 1][x];
  A[1][x] = temp;
}
int main() {
  int t1, t2, t3, t4;
  int Q;
  scanf("%d %d %d", &N, &M, &Q);
  for (int i = 0; i < Q; ++i) {
    scanf("%d", &IN[i][0]);
    switch (IN[i][0]) {
      case 1:
      case 2:
        scanf("%d", &IN[i][1]);
        break;
      case 3:
        scanf("%d %d %d", &IN[i][1], &IN[i][2], &IN[i][3]);
    }
  }
  for (int i = Q - 1; i >= 0; --i) {
    switch (IN[i][0]) {
      case 1:
        shift_right(IN[i][1]);
        break;
      case 2:
        shift_bottom(IN[i][1]);
        break;
      case 3:
        A[IN[i][1]][IN[i][2]] = IN[i][3];
    }
  }
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) printf("%d ", A[i][j]);
    printf("\n");
  }
  return 0;
}
