#include <bits/stdc++.h>
using namespace std;
vector<tuple<int, int, int, int> > ask;
int mat[105][105];
int main() {
  int n, m, q, op, r, c, x, i, j;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &op);
    if (op == 1 || op == 2) {
      scanf("%d", &x);
      ask.emplace_back(op, x, 0, 0);
    } else {
      scanf("%d%d%d", &r, &c, &x);
      ask.emplace_back(op, r, c, x);
    }
  }
  for (i = ask.size() - 1; i >= 0; i--) {
    tie(op, r, c, x) = ask[i];
    if (op == 1)
      for (j = m - 1; j >= 1; j--) swap(mat[r][j + 1], mat[r][j]);
    else if (op == 2)
      for (j = n - 1; j >= 1; j--) swap(mat[j + 1][r], mat[j][r]);
    else
      mat[r][c] = x;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) printf("%d ", mat[i][j]);
    printf("\n");
  }
}
