#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<pair<pair<int, int>, pair<int, int> > > t(q);
  for (int i = 0; i < q; ++i) {
    cin >> t[i].first.first >> t[i].first.second;
    if (t[i].first.first == 3) cin >> t[i].second.first >> t[i].second.second;
  }
  while (q > 0) {
    --q;
    if (t[q].first.first == 1) {
      int r = t[q].first.second;
      --r;
      int x = a[r][m - 1];
      for (int j = m - 1; j > 0; --j) a[r][j] = a[r][j - 1];
      a[r][0] = x;
    } else if (t[q].first.first == 2) {
      int r = t[q].first.second;
      --r;
      int x = a[n - 1][r];
      for (int i = n - 1; i > 0; --i) a[i][r] = a[i - 1][r];
      a[0][r] = x;
    } else {
      int x, y, v;
      x = t[q].first.second, y = t[q].second.first, v = t[q].second.second;
      --x, --y;
      a[x][y] = v;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cout << a[i][j] << ' ';
    cout << endl;
  }
}
