#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int ans = 0;
int mat[N + 5][N + 5];
vector<vector<pair<int, int> > > matp;
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  memset(mat, 0, sizeof(mat));
  matp.resize(n, vector<pair<int, int> >(m, {0, 0}));
  for (int i = 0; i < q; i++) {
    int ti;
    scanf("%d", &ti);
    if (ti == 1) {
      int ri;
      scanf("%d", &ri);
      ri--;
      pair<int, int> temp = matp[ri][0];
      for (int k = 0; k < m - 1; k++) {
        matp[ri][k] = matp[ri][k + 1];
      }
      matp[ri][m - 1] = temp;
      for (int k = 0; k < m; k++) matp[ri][k].second++;
    } else if (ti == 2) {
      int ci;
      scanf("%d", &ci);
      ci--;
      pair<int, int> temp = matp[0][ci];
      for (int k = 0; k < n - 1; k++) {
        matp[k][ci] = matp[k + 1][ci];
      }
      matp[n - 1][ci] = temp;
      for (int k = 0; k < n; k++) matp[k][ci].first++;
    } else {
      int ri, ci, xi;
      scanf("%d%d%d", &ri, &ci, &xi);
      ri--;
      ci--;
      mat[abs(ri + matp[ri][ci].first) % n][abs(ci + matp[ri][ci].second) % m] =
          xi;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}
