#include <bits/stdc++.h>
using namespace std;
const int N = 104;
int a[N][N];
struct node {
  int tt, rr, cc, xx;
} qry[100004];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= q; i++) {
    int ty;
    scanf("%d", &ty);
    qry[i].tt = ty;
    if (ty == 1)
      scanf("%d", &qry[i].rr);
    else if (ty == 2)
      scanf("%d", &qry[i].cc);
    else
      scanf("%d %d %d", &qry[i].rr, &qry[i].cc, &qry[i].xx);
  }
  for (int i = q; i >= 1; i--) {
    int t;
    t = qry[i].tt;
    if (t == 1) {
      int r;
      r = qry[i].rr;
      int val = a[r][m];
      for (int j = m; j >= 2; j--) a[r][j] = a[r][j - 1];
      a[r][1] = val;
    } else if (t == 2) {
      int c;
      c = qry[i].cc;
      int val = a[n][c];
      for (int i = n; i >= 2; i--) a[i][c] = a[i - 1][c];
      a[1][c] = val;
    } else {
      int r, c, x;
      r = qry[i].rr, c = qry[i].cc, x = qry[i].xx;
      a[r][c] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", a[i][j]);
    printf("\n");
  }
  return 0;
}
