#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
const int MAXN = (int)1e6 + 5;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
int a[101][101];
int n, m, q;
struct Q {
  int type, r, c, x;
  Q() {}
  Q(int type, int r, int c, int x) : type(type), r(r), c(c), x(x) {}
};
vector<Q> v;
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; ++i) {
    int t, r = 0, c = 0, x = 0;
    cin >> t;
    if (t == 1) {
      cin >> r;
      --r;
    }
    if (t == 2) {
      cin >> c;
      --c;
    }
    if (t == 3) {
      cin >> r >> c >> x;
      --r;
      --c;
    }
    v.push_back(Q(t, r, c, x));
  }
  for (int i = q - 1; i >= 0; --i) {
    Q b = v[i];
    int type = b.type;
    int r = b.r;
    int c = b.c;
    int x = b.x;
    if (type == 3) {
      a[r][c] = x;
    }
    if (type == 1) {
      vector<int> V;
      V.push_back(a[r][m - 1]);
      for (int j = 0; j < m - 1; ++j) V.push_back(a[r][j]);
      for (int j = 0; j < m; ++j) a[r][j] = V[j];
    }
    if (type == 2) {
      vector<int> V;
      V.push_back(a[n - 1][c]);
      for (int j = 0; j < n - 1; ++j) V.push_back(a[j][c]);
      for (int j = 0; j < n; ++j) a[j][c] = V[j];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << a[i][j] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
