#include <bits/stdc++.h>
using namespace std;
int n, m, q, pos;
int a[102][102];
int main() {
  cin >> n >> m >> q;
  vector<pair<int, pair<int, int>>> quer;
  vector<int> x;
  for (int i = 0, t, r, c, z; i < q; ++i) {
    cin >> t;
    if (t < 3) {
      cin >> r;
      quer.push_back({t, {--r, -1}});
    } else {
      cin >> r >> c >> z;
      x.push_back(z);
      quer.push_back({3, {--r, --c}});
    }
  }
  reverse(quer.begin(), quer.end());
  reverse(x.begin(), x.end());
  for (int i = 0; i < q; ++i) {
    if (quer[i].first == 3) {
      a[quer[i].second.first][quer[i].second.second] = x[pos++];
    } else {
      if (quer[i].first == 1) {
        int r = quer[i].second.first;
        int temp = a[r][m - 1];
        for (int i = m - 1; i; --i) {
          a[r][i] = a[r][i - 1];
        }
        a[r][0] = temp;
      } else {
        int c = quer[i].second.first;
        int temp = a[n - 1][c];
        for (int i = n - 1; i; --i) {
          a[i][c] = a[i - 1][c];
        }
        a[0][c] = temp;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
