#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
int mat[105][105];
int n, m, q;
void init() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      mat[i][j] = 0;
    }
}
void shiftRowI(int i) {
  int lst = mat[i][m - 1];
  for (int j = m - 2; j >= 0; j--) {
    mat[i][j + 1] = mat[i][j];
  }
  mat[i][0] = lst;
}
void shifCol(int j) {
  int lst = mat[n - 1][j];
  for (int i = n - 2; i >= 0; i--) {
    mat[i + 1][j] = mat[i][j];
  }
  mat[0][j] = lst;
}
void solve(int qq) {
  if (qq == 0) return;
  int type;
  scanf("%d", &type);
  if (type == 1) {
    int r;
    scanf("%d", &r);
    solve(qq - 1);
    r--;
    shiftRowI(r);
  } else if (type == 2) {
    int c;
    scanf("%d", &c);
    solve(qq - 1);
    c--;
    shifCol(c);
  } else {
    int r, c, x;
    scanf("%d%d%d", &r, &c, &x);
    solve(qq - 1);
    r--, c--;
    mat[r][c] = x;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  init();
  solve(q);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) printf("%d%c", mat[i][j], " \n"[j == m - 1]);
}
