#include <bits/stdc++.h>
using namespace std;
int n, m, mat[111][111], q;
struct Node {
  int t, r, c, x;
} Q[10005];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) mat[i][j] = 0;
  for (int i = 0; i < q; i++) {
    scanf("%d", &Q[i].t);
    if (Q[i].t == 3)
      scanf("%d%d%d", &Q[i].r, &Q[i].c, &Q[i].x);
    else
      scanf("%d", &Q[i].r);
  }
  for (int i = q - 1; i >= 0; i--) {
    if (Q[i].t == 1)
      for (int a = m; a > 1; a--) swap(mat[Q[i].r][a], mat[Q[i].r][a - 1]);
    if (Q[i].t == 2)
      for (int a = n; a > 1; a--) swap(mat[a][Q[i].r], mat[a - 1][Q[i].r]);
    if (Q[i].t == 3) mat[Q[i].r][Q[i].c] = Q[i].x;
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) puts("");
    for (int j = 1; j <= m; j++) {
      if (j > 1) printf(" ");
      printf("%d", mat[i][j]);
    }
  }
  return 0;
}
