#include <bits/stdc++.h>
using namespace std;
std::vector<int> q1;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int>> ans(n, vector<int>(m, 0));
  for (int it = 0; it < q; ++it) {
    int t1, t;
    cin >> t1;
    if (t1 == 1) {
      cin >> t;
      q1.push_back(t);
    } else if (t1 == 2) {
      cin >> t;
      q1.push_back(-t);
    } else {
      int a, b, c;
      cin >> a >> b >> c;
      a--, b--;
      for (int j = (int)q1.size() - 1; j >= 0; --j) {
        if (q1[j] > 0) {
          if (a == q1[j] - 1) {
            b++, b %= m;
          }
        } else {
          if (b == -q1[j] - 1) {
            a++, a %= n;
          }
        }
      }
      a %= n;
      b %= m;
      ans[a][b] = c;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
