#include <bits/stdc++.h>
using namespace std;
struct query {
  int t, r, c, x;
  query(int t, int r, int c, int x) {
    this->t = t;
    this->r = r;
    this->c = c;
    this->x = x;
  }
};
int n, m, q, t, r, c, x, i, j, ans[101][101];
vector<query> queries;
int main() {
  cin >> n >> m >> q;
  for (i = 0; i < q; ++i) {
    scanf("%d", &t);
    switch (t) {
      case 1:
        scanf("%d", &r);
        break;
      case 2:
        scanf("%d", &c);
        break;
      case 3:
        scanf("%d %d %d", &r, &c, &x);
        break;
    }
    queries.push_back(query(t, r - 1, c - 1, x));
  }
  for (i = 0; i < q; ++i) {
    if (queries[i].t != 3) continue;
    r = queries[i].r;
    c = queries[i].c;
    for (j = i - 1; j >= 0; --j) {
      switch (queries[j].t) {
        case 1:
          if (r == queries[j].r) c = (c + 1) % m;
          break;
        case 2:
          if (c == queries[j].c) r = (r + 1) % n;
          break;
      }
    }
    ans[r][c] = queries[i].x;
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) cout << ans[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
