#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<pair<int, int>>> pos(n);
  vector<vector<int>> ans(n);
  for (auto &t : pos) t.resize(m);
  for (auto &t : ans) t.resize(m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      pos[i][j] = {i, j};
    }
  }
  while (q--) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int r;
      cin >> r;
      r--;
      rotate(pos[r].begin(), ++pos[r].begin(), pos[r].end());
    }
    if (tp == 2) {
      int c;
      cin >> c;
      c--;
      pair<int, int> tmp = pos[0][c];
      for (int i = 1; i < n; i++) {
        pos[i - 1][c] = pos[i][c];
      }
      pos[n - 1][c] = tmp;
    }
    if (tp == 3) {
      int r, c;
      cin >> r >> c;
      r--;
      c--;
      int x;
      cin >> x;
      pair<int, int> tmp = pos[r][c];
      ans[tmp.first][tmp.second] = x;
    }
  }
  for (auto t : ans) {
    for (auto y : t) cout << y << " ";
    cout << endl;
  }
}
