#include <bits/stdc++.h>
using namespace std;
int r[123];
int c[123];
int arr[123][123];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q, h, x, y, a;
  vector<pair<int, int> > v;
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> h;
    if (h == 3) {
      cin >> x >> y >> a;
      x--;
      y--;
      for (int j = v.size() - 1; j >= 0; j--) {
        if (v[j].first == 1 && v[j].second == x) {
          y++;
          y %= m;
        }
        if (v[j].first == 2 && v[j].second == y) {
          x++;
          x %= n;
        }
      }
      arr[x][y] = a;
    } else {
      cin >> x;
      v.push_back(make_pair(h, x - 1));
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << arr[i][j] << " ";
    cout << endl;
  }
  return 0;
}
