#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int a[105][105];
struct request {
  int type;
  int r, c, v;
  request(int _t, int _r, int _c = -1, int _v = 0)
      : type(_t), r(_r), c(_c), v(_v){};
  request(){};
};
vector<request> v;
int main(void) {
  scanf("%d%d%d", &n, &m, &q);
  for (int(i) = 0; (i) < (q); (i)++) {
    int t;
    scanf("%d", &t);
    int r;
    scanf("%d", &r);
    r--;
    if (t > 2) {
      int c, val;
      scanf("%d%d", &c, &val);
      c--;
      v.push_back(request(t, r, c, val));
    } else {
      v.push_back(request(t, r));
    }
  }
  memset((a), (0), sizeof((a)));
  for (int(i) = (q)-1; (i) >= 0; (i)--) {
    if (v[i].type == 3) {
      a[v[i].r][v[i].c] = v[i].v;
    } else {
      if (v[i].type == 1) {
        int temp = a[v[i].r][m - 1];
        for (int(j) = (m - 1); (j) >= (1); (j)--) {
          a[v[i].r][j] = a[v[i].r][j - 1];
        }
        a[v[i].r][0] = temp;
      } else {
        int temp = a[n - 1][v[i].r];
        for (int(j) = (n - 1); (j) >= (1); (j)--) {
          a[j][v[i].r] = a[j - 1][v[i].r];
        }
        a[0][v[i].r] = temp;
      }
    }
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    for (int(j) = 0; (j) < (m); (j)++) {
      printf("%d ", a[i][j]);
    }
    printf("\n");
  }
}
