#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<pair<int, int>>> pos(n, vector<pair<int, int>>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      pos[i][j] = {i, j};
    }
  }
  vector<vector<int>> val(n, vector<int>(m, 0));
  for (int i = 0; i < q; ++i) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      --r;
      auto tmp = pos[r][0];
      for (int i = 1; i < m; ++i) {
        pos[r][i - 1] = pos[r][i];
      }
      pos[r][m - 1] = tmp;
    } else if (t == 2) {
      int c;
      cin >> c;
      --c;
      auto tmp = pos[0][c];
      for (int i = 1; i < n; ++i) {
        pos[i - 1][c] = pos[i][c];
      }
      pos[n - 1][c] = tmp;
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      --r, --c;
      auto p = pos[r][c];
      val[p.first][p.second] = x;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << val[i][j] << " ";
    }
    cout << endl;
  }
}
