#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const double pi = acos(-1);
const int N = 128;
int f[N][N];
int n, m, q;
struct Query {
  int type, r, c, v;
  void read() {
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d", &r);
    } else if (type == 2) {
      scanf("%d", &c);
    } else if (type == 3) {
      scanf("%d%d%d", &r, &c, &v);
    }
  }
} query[10010];
void solve(int ncase) {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    query[i].read();
  }
  for (int i = q - 1; i >= 0; i--) {
    if (query[i].type == 3) {
      f[query[i].r][query[i].c] = query[i].v;
    } else if (query[i].type == 1) {
      int laste = f[query[i].r][m];
      for (int j = m; j > 1; j--) {
        f[query[i].r][j] = f[query[i].r][j - 1];
      }
      f[query[i].r][1] = laste;
    } else {
      int laste = f[n][query[i].c];
      for (int j = n; j >= 2; j--) {
        f[j][query[i].c] = f[j - 1][query[i].c];
      }
      f[1][query[i].c] = laste;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d%c", f[i][j], j < m ? ' ' : '\n');
    }
  }
}
int main() {
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}
