#include <bits/stdc++.h>
using namespace std;
int board[110][110];
int tp[10010], r[10010], c[10010], val[10010];
int main() {
  int N, M, Q, t;
  scanf("%d%d%d", &N, &M, &Q);
  memset(board, 0, sizeof(board));
  for (int i = (0); i < (Q); i++) {
    scanf("%d", tp + i);
    if (tp[i] == 1) {
      scanf("%d", r + i);
    } else if (tp[i] == 2) {
      scanf("%d", c + i);
    } else {
      scanf("%d%d%d", r + i, c + i, val + i);
    }
  }
  for (int i = Q - 1; i >= 0; i--) {
    if (tp[i] == 1) {
      t = board[r[i]][M];
      for (int j = M; j > 1; j--) board[r[i]][j] = board[r[i]][j - 1];
      board[r[i]][1] = t;
    } else if (tp[i] == 2) {
      t = board[N][c[i]];
      for (int j = N; j > 1; j--) board[j][c[i]] = board[j - 1][c[i]];
      board[1][c[i]] = t;
    } else {
      board[r[i]][c[i]] = val[i];
    }
  }
  for (int i = (1); i < (N + 1); i++)
    for (int j = (1); j < (M + 1); j++) {
      if (j == M)
        printf("%d\n", board[i][j]);
      else
        printf("%d ", board[i][j]);
    }
  return 0;
}
