#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
istream& operator>>(istream& is, pair<S, T>& p) {
  return is >> p.first >> p.second;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
const int INF = 2e9;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int H, W, Q;
  cin >> H >> W >> Q;
  vector<vector<int> > qs(Q);
  for (int q = (0); q < (Q); ++q) {
    int t;
    cin >> t;
    if (t == 1 || t == 2) {
      int x;
      cin >> x;
      --x;
      qs[q].push_back(t);
      qs[q].push_back(x);
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      --r;
      --c;
      qs[q].push_back(t);
      qs[q].push_back(r);
      qs[q].push_back(c);
      qs[q].push_back(x);
    }
  }
  vector<vector<int> > tab(H, vector<int>(W, 0));
  for (int q = Q - 1; q >= 0; --q) {
    if (qs[q][0] == 3) {
      int r = qs[q][1], c = qs[q][2], x = qs[q][3];
      tab[r][c] = x;
    } else if (qs[q][0] == 1) {
      int r = qs[q][1];
      int tmp = tab[r][W - 1];
      for (int x = W - 1; x > 0; --x) tab[r][x] = tab[r][x - 1];
      tab[r][0] = tmp;
    } else {
      int c = qs[q][1];
      int tmp = tab[H - 1][c];
      for (int y = H - 1; y > 0; --y) tab[y][c] = tab[y - 1][c];
      tab[0][c] = tmp;
    }
  }
  for (int y = (0); y < (H); ++y) {
    for (int x = (0); x < (W); ++x) cout << (x ? " " : "") << tab[y][x];
    cout << endl;
  }
  return 0;
}
