#include <bits/stdc++.h>
using namespace std;
struct Data {
  int op, r, c, x;
};
int a[110][110];
Data d[10010];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &d[i].op);
    if (d[i].op == 1)
      scanf("%d", &d[i].r);
    else if (d[i].op == 2)
      scanf("%d", &d[i].c);
    else
      scanf("%d%d%d", &d[i].r, &d[i].c, &d[i].x);
  }
  for (int i = q; i >= 1; i--) {
    if (d[i].op == 3)
      a[d[i].r][d[i].c] = d[i].x;
    else if (d[i].op == 1) {
      int tmp = a[d[i].r][m];
      for (int j = m; j >= 2; j--) a[d[i].r][j] = a[d[i].r][j - 1];
      a[d[i].r][1] = tmp;
    } else if (d[i].op == 2) {
      int tmp = a[n][d[i].c];
      for (int j = n; j >= 2; j--) a[j][d[i].c] = a[j - 1][d[i].c];
      a[1][d[i].c] = tmp;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < m; j++) printf("%d ", a[i][j]);
    printf("%d\n", a[i][m]);
  }
  return 0;
}
