#include <bits/stdc++.h>
using namespace std;
long long ex(long long a, long long b) {
  long long result = 1;
  while (b) {
    if (b % 2 == 1) {
      result = (result * a) % 1000000007;
    }
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  stack<pair<int, int>> s;
  stack<pair<pair<int, int>, int>> sp;
  pair<pair<int, int>, int> ppi;
  pair<int, int> pp;
  int t, i, j, n, q, m;
  cin >> n >> m >> q;
  int ans[n][m];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) ans[i][j] = 0;
  while (q--) {
    int type;
    cin >> type;
    if (type == 1 || type == 2) {
      int op;
      cin >> op;
      s.push(make_pair(type, op));
    } else {
      int r, c, val;
      cin >> r >> c >> val;
      s.push(make_pair(0, 0));
      sp.push(make_pair(make_pair(r, c), val));
    }
  }
  while (!s.empty()) {
    pp = s.top();
    if (pp.first == 0) {
      ppi = sp.top();
      ans[ppi.first.first - 1][ppi.first.second - 1] = ppi.second;
      sp.pop();
    } else {
      if (pp.first == 1) {
        int fr = ans[pp.second - 1][m - 1];
        int temp1 = ans[pp.second - 1][0];
        int temp2;
        for (i = 1; i < m; i++) {
          temp2 = ans[pp.second - 1][i];
          ans[pp.second - 1][i] = temp1;
          temp1 = temp2;
        }
        ans[pp.second - 1][0] = fr;
      } else {
        int fc = ans[n - 1][pp.second - 1];
        int temp1 = ans[0][pp.second - 1];
        int temp2;
        for (i = 1; i < n; i++) {
          temp2 = ans[i][pp.second - 1];
          ans[i][pp.second - 1] = temp1;
          temp1 = temp2;
        }
        ans[0][pp.second - 1] = fc;
      }
    }
    s.pop();
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
