#include <bits/stdc++.h>
using namespace std;
int Q[100010][4], graph[110][110];
int n, m, q;
void solve() {
  for (int i = q - 1; i >= 0; i--) {
    if (Q[i][0] == 3) {
      graph[Q[i][1]][Q[i][2]] = Q[i][3];
    } else if (Q[i][0] == 1) {
      int temp = graph[Q[i][1]][m];
      for (int j = m; j >= 2; j--) {
        graph[Q[i][1]][j] = graph[Q[i][1]][j - 1];
      }
      graph[Q[i][1]][1] = temp;
    } else {
      int temp = graph[n][Q[i][1]];
      for (int j = n; j >= 2; j--) {
        graph[j][Q[i][1]] = graph[j - 1][Q[i][1]];
      }
      graph[1][Q[i][1]] = temp;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (j == 1)
        printf("%d", graph[i][j]);
      else
        printf(" %d", graph[i][j]);
    }
    printf("\n");
  }
}
int main() {
  while (cin >> n >> m >> q) {
    memset(graph, 0, sizeof(graph));
    for (int i = 0; i < q; i++) {
      scanf("%d", &Q[i][0]);
      scanf("%d", &Q[i][1]);
      if (Q[i][0] == 3) {
        scanf("%d%d", &Q[i][2], &Q[i][3]);
      }
    }
    solve();
  }
  return 0;
}
