#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<array<int, 4>> op(q);
  for (int i = 0; i < q; i++) {
    cin >> op[i][0];
    if (op[i][0] == 3) {
      cin >> op[i][1] >> op[i][2] >> op[i][3];
    } else {
      cin >> op[i][1];
      op[i][2] = INT_MIN;
      op[i][3] = INT_MIN;
    }
  }
  reverse(op.begin(), op.end());
  vector<vector<int>> ans(n, vector<int>(m, 0));
  for (int i = 0; i < q; i++) {
    if (op[i][0] == 1) {
      int c = op[i][1] - 1;
      int tmp = ans[c][m - 1];
      for (int j = m - 1; j >= 1; j--) {
        ans[c][j] = ans[c][j - 1];
      }
      ans[c][0] = tmp;
    } else if (op[i][0] == 2) {
      int r = op[i][1] - 1;
      int tmp = ans[n - 1][r];
      for (int j = n - 1; j >= 1; j--) {
        ans[j][r] = ans[j - 1][r];
      }
      ans[0][r] = tmp;
    } else {
      ans[op[i][1] - 1][op[i][2] - 1] = op[i][3];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
}
