#include <bits/stdc++.h>
using namespace std;
int main() {
  long q, m, n, i, j, dummy, a, b, x, y, t, x1, y1;
  cin >> n >> m >> q;
  vector<vector<long> > R(100, vector<long>(100, 0));
  vector<vector<long> > C(100, vector<long>(100, 0));
  vector<vector<long> > E(100, vector<long>(100, 0));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      R[i][j] = i;
      C[i][j] = j;
    }
  }
  for (dummy = 0; dummy < q; dummy++) {
    cin.ignore();
    cin >> t >> b;
    if (t == 1) {
      x1 = R[b - 1][0];
      y1 = C[b - 1][0];
      for (j = 0; j < m - 1; j++) {
        R[b - 1][j] = R[b - 1][j + 1];
        C[b - 1][j] = C[b - 1][j + 1];
      }
      R[b - 1][m - 1] = x1;
      C[b - 1][m - 1] = y1;
    }
    if (t == 2) {
      x1 = R[0][b - 1];
      y1 = C[0][b - 1];
      for (i = 0; i < n - 1; i++) {
        R[i][b - 1] = R[i + 1][b - 1];
        C[i][b - 1] = C[i + 1][b - 1];
      }
      R[n - 1][b - 1] = x1;
      C[n - 1][b - 1] = y1;
    }
    if (t == 3) {
      x = b;
      cin >> y >> a;
      x1 = R[x - 1][y - 1];
      y1 = C[x - 1][y - 1];
      E[x1][y1] = a;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cout << E[i][j];
      cout << " ";
    }
    cout << "\n";
  }
  return 0;
}
