#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > ans(n, vector<int>(m, 0));
  vector<pair<int, int> > help;
  for (int idx = 0; idx < q; ++idx) {
    int t;
    cin >> t;
    if (t == 1) {
      int s;
      cin >> s;
      --s;
      help.push_back(make_pair(t, s));
      int tmp = ans[s][0];
      for (int i = 0; i < m - 1; ++i) ans[s][i] = ans[s][i + 1];
      ans[s][m - 1] = tmp;
    } else if (t == 2) {
      int s;
      cin >> s;
      --s;
      help.push_back(make_pair(t, s));
      int tmp = ans[0][s];
      for (int i = 0; i < n - 1; ++i) ans[i][s] = ans[i + 1][s];
      ans[n - 1][s] = tmp;
    } else {
      int i, j, x;
      cin >> i >> j >> x;
      ans[i - 1][j - 1] = x;
    }
  }
  for (int j = help.size() - 1; j >= 0; --j)
    if (help[j].first == 1) {
      int s = help[j].second;
      int tmp = ans[s][m - 1];
      for (int i = m - 1; i > 0; --i) ans[s][i] = ans[s][i - 1];
      ans[s][0] = tmp;
    } else {
      int s = help[j].second;
      int tmp = ans[n - 1][s];
      for (int i = n - 1; i > 0; --i) ans[i][s] = ans[i - 1][s];
      ans[0][s] = tmp;
    }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cout << ans[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
