#include <bits/stdc++.h>
using namespace std;
pair<int, int> B[101][101];
int A[101][101];
int main() {
  int n, m, i, j, k, c, q;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      B[i][j].first = i;
      B[i][j].second = j;
    }
  while (q--) {
    scanf("%d", &c);
    if (c == 1) {
      scanf("%d", &i);
      for (j = 0; j < m; j++) B[i][j] = B[i][j + 1];
      B[i][m] = B[i][0];
    }
    if (c == 2) {
      scanf("%d", &j);
      for (i = 0; i < n; i++) B[i][j] = B[i + 1][j];
      B[n][j] = B[0][j];
    }
    if (c == 3) {
      scanf("%d%d%d", &i, &j, &k);
      A[B[i][j].first][B[i][j].second] = k;
    }
  }
  for (i = 1; i <= n; printf("\n"), i++)
    for (j = 1; j <= m; j++) printf("%d ", A[i][j]);
  return 0;
}
