#include <bits/stdc++.h>
using namespace std;
pair<int, int> A[105][105];
int mat[105][105];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      A[i][j] = make_pair(i, j);
    }
  }
  for (int i = 1; i <= q; i++) {
    int type, r, c, v;
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d", &r);
      pair<int, int> pp = A[r][1];
      for (int i = 1; i < m; i++) {
        A[r][i] = A[r][i + 1];
      }
      A[r][m] = pp;
    }
    if (type == 2) {
      scanf("%d", &c);
      pair<int, int> pp = A[1][c];
      for (int i = 1; i < n; i++) {
        A[i][c] = A[i + 1][c];
      }
      A[n][c] = pp;
    } else if (type == 3) {
      scanf("%d %d %d", &r, &c, &v);
      pair<int, int> pos = A[r][c];
      mat[pos.first][pos.second] = v;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}
