#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int ans[N][N];
vector<pair<int, int>> a;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x;
      scanf("%d", &x);
      a.emplace_back(x - 1, 1);
    }
    if (t == 2) {
      int x;
      scanf("%d", &x);
      a.emplace_back(x - 1, 2);
    }
    if (t == 3) {
      int rs, cs, x;
      scanf("%d%d%d", &cs, &rs, &x);
      rs--;
      cs--;
      for (int j = a.size() - 1; j >= 0; j--) {
        int ind = a[j].first;
        int t = a[j].second;
        if (t == 2) {
          if (rs == ind) {
            cs = (cs + 1 + n) % n;
          }
        } else {
          if (cs == ind) {
            rs = (rs + 1 + m) % m;
          }
        }
      }
      ans[cs][rs] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", ans[i][j]);
    }
    printf("\n");
  }
  return 0;
}
