#include <bits/stdc++.h>
using namespace std;
struct op {
  int type;
  int a, b;
  int val;
};
int M[110][110] = {};
int n, m, q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> q;
  stack<op> S;
  while (q--) {
    op tmp;
    int c;
    cin >> c;
    tmp.type = c;
    if (c == 1 || c == 2)
      cin >> tmp.val;
    else
      cin >> tmp.a >> tmp.b >> tmp.val;
    S.push(tmp);
  }
  while (!S.empty()) {
    op P = S.top();
    S.pop();
    if (P.type == 1) {
      int u = P.val;
      int last = M[u][m];
      for (int j = m; j > 1; --j) M[u][j] = M[u][j - 1];
      M[u][1] = last;
    } else if (P.type == 2) {
      int u = P.val;
      int last = M[n][u];
      for (int i = n; i > 1; --i) M[i][u] = M[i - 1][u];
      M[1][u] = last;
    } else if (P.type == 3) {
      M[P.a][P.b] = P.val;
    } else {
      cout << P.type << endl;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) cout << M[i][j] << " ";
    cout << endl;
  }
  return 0;
}
