#include <bits/stdc++.h>
using namespace std;
void rr(vector<vector<long long>> &m, long long r, long long nr, long long nc) {
  long long t = m[r - 1][nc - 1];
  for (long long i = nc - 2; i >= 0; i--) m[r - 1][i + 1] = m[r - 1][i];
  m[r - 1][0] = t;
  return;
}
void rc(vector<vector<long long>> &m, long long c, long long nr, long long nc) {
  long long t = m[nr - 1][c - 1];
  for (long long i = nr - 2; i >= 0; i--) m[i + 1][c - 1] = m[i][c - 1];
  m[0][c - 1] = t;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, q, t;
  cin >> n >> m >> q;
  vector<vector<long long>> mat(n, vector<long long>(m, 0));
  vector<vector<long long>> op;
  for (long long i = 0; i < q; i++) {
    cin >> t;
    if (t == 1 || t == 2) {
      long long roc;
      cin >> roc;
      op.push_back({t, roc});
    } else {
      long long r, c, x;
      cin >> r >> c >> x;
      op.push_back({t, r, c, x});
    }
  }
  bool f3 = false;
  for (long long i = op.size() - 1; i >= 0; i--) {
    if (!f3) {
      if (op[i][0] == 3) {
        f3 = true;
        mat[op[i][1] - 1][op[i][2] - 1] = op[i][3];
      }
    } else {
      if (op[i][0] == 1) {
        rr(mat, op[i][1], n, m);
      } else if (op[i][0] == 2) {
        rc(mat, op[i][1], n, m);
      } else {
        mat[op[i][1] - 1][op[i][2] - 1] = op[i][3];
      }
    }
  }
  for (auto i : mat) {
    for (auto j : i) cout << j << " ";
    cout << endl;
  }
  return 0;
}
