#include <bits/stdc++.h>
using namespace std;
int p[100][100];
pair<int, int> now[100][100];
int main() {
  int r, c, q, t, i, k, x, y, val;
  pair<int, int> tem;
  scanf("%d %d %d", &r, &c, &q);
  for (i = 0; i < r; i++)
    for (k = 0; k < c; k++) now[i][k] = make_pair(i, k);
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      x--;
      tem = now[x][0];
      for (i = 0; i < c - 1; i++) now[x][i] = now[x][(i + 1) % c];
      now[x][c - 1] = tem;
    } else if (t == 2) {
      scanf("%d", &x);
      x--;
      tem = now[0][x];
      for (i = 0; i < r - 1; i++) now[i][x] = now[(i + 1) % r][x];
      now[r - 1][x] = tem;
    } else {
      scanf("%d %d %d", &x, &y, &val);
      x--;
      y--;
      p[now[x][y].first][now[x][y].second] = val;
    }
  }
  for (i = 0; i < r; i++) {
    for (k = 0; k < c; k++) {
      if (k) printf(" ");
      printf("%d", p[i][k]);
    }
    printf("\n");
  }
  return 0;
}
