#include <bits/stdc++.h>
using namespace std;
int n, m, q, x, y, z, ar[202][202], t;
vector<pair<pair<int, int>, pair<int, int> > > v;
int main() {
  scanf("%d %d %d", &n, &m, &q);
  while (q--) {
    scanf("%d", &t);
    scanf("%d", &x);
    if (t == 3) {
      scanf("%d %d", &y, &z);
    }
    v.push_back(make_pair(make_pair(t, x), make_pair(y, z)));
  }
  for (int i = v.size() - 1; i >= 0; i--) {
    if (v[i].first.first == 3) {
      ar[v[i].first.second][v[i].second.first] = v[i].second.second;
    } else if (v[i].first.first == 2) {
      z = ar[n][v[i].first.second];
      for (int k = n - 1; k >= 0; k--) {
        ar[k + 1][v[i].first.second] = ar[k][v[i].first.second];
      }
      ar[1][v[i].first.second] = z;
    } else {
      z = ar[v[i].first.second][m];
      for (int k = m - 1; k >= 0; k--) {
        ar[v[i].first.second][k + 1] = ar[v[i].first.second][k];
      }
      ar[v[i].first.second][1] = z;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", ar[i][j]);
    }
    printf("\n");
  }
}
