#include <bits/stdc++.h>
using namespace std;
const int MAX_H = 100;
const int MAX_W = 100;
int hs[MAX_H], vs[MAX_W];
int ps[MAX_H][MAX_W], as[MAX_H * MAX_W];
int main() {
  int h, w, q;
  scanf("%d%d%d", &h, &w, &q);
  for (int y = 0, p = 0; y < h; y++)
    for (int x = 0; x < w; x++, p++) ps[y][x] = p;
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int y;
      scanf("%d", &y);
      y--;
      int tp = ps[y][0];
      for (int x = 1; x < w; x++) ps[y][x - 1] = ps[y][x];
      ps[y][w - 1] = tp;
    } else if (op == 2) {
      int x;
      scanf("%d", &x);
      x--;
      int tp = ps[0][x];
      for (int y = 1; y < h; y++) ps[y - 1][x] = ps[y][x];
      ps[h - 1][x] = tp;
    } else {
      int y, x, v;
      scanf("%d%d%d", &y, &x, &v);
      y--, x--;
      as[ps[y][x]] = v;
    }
  }
  for (int y = 0, p = 0; y < h; y++)
    for (int x = 0; x < w; x++, p++) {
      printf("%d", as[p]);
      putchar(x + 1 < w ? ' ' : '\n');
    }
  return 0;
}
