#include <bits/stdc++.h>
using namespace std;
bool solve() {
  int n, m, q;
  if (scanf("%d%d%d", &n, &m, &q) != -1) {
    std::vector<std::vector<int>> ans(n, std::vector<int>(m));
    std::vector<std::vector<pair<int, int>>> perm(
        n, std::vector<pair<int, int>>(m));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        perm[i][j] = std::make_pair(i, j);
      }
    }
    for (int k = 0; k < q; k++) {
      int t;
      scanf("%d", &t);
      if (t == 1) {
        int r;
        scanf("%d", &r);
        r--;
        for (int i = 0; i + 1 < m; i++) {
          std::swap(perm[r][i], perm[r][i + 1]);
        }
      } else if (t == 2) {
        int c;
        scanf("%d", &c);
        c--;
        for (int i = 0; i + 1 < n; i++) {
          std::swap(perm[i][c], perm[i + 1][c]);
        }
      } else {
        int r, c, x;
        scanf("%d %d %d", &r, &c, &x);
        r--, c--;
        ans[perm[r][c].first][perm[r][c].second] = x;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        printf("%d%c", ans[i][j], " \n"[j + 1 == m]);
      }
    }
    return true;
  }
  return false;
}
int main() {
  auto t = clock() / CLOCKS_PER_SEC;
  while (solve()) {
    auto nt = clock() / CLOCKS_PER_SEC;
    cerr << "TIME: " << (nt - t) << endl;
    t = nt;
  }
  return 0;
}
