#include <bits/stdc++.h>
using namespace std;
inline int cmp(double x, double y = 0, double tol = 1e-10) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
pair<int, int> grid[105][105];
int ans[105][105];
int n, m;
void rodarLinha(int r) {
  pair<int, int> tmp = grid[r][0];
  for (int i = 0; i < m - 1; i++) grid[r][i] = grid[r][i + 1];
  grid[r][m - 1] = tmp;
}
void rodarColuna(int c) {
  pair<int, int> tmp = grid[0][c];
  for (int i = 0; i < n - 1; i++) grid[i][c] = grid[i + 1][c];
  grid[n - 1][c] = tmp;
}
int main() {
  int q, t, r, c, x;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) grid[i][j] = {i, j};
  memset(ans, 0, sizeof ans);
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &r);
      rodarLinha(r - 1);
    } else if (t == 2) {
      scanf("%d", &c);
      rodarColuna(c - 1);
    } else {
      scanf("%d %d %d", &r, &c, &x);
      ans[grid[r - 1][c - 1].first][grid[r - 1][c - 1].second] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
