#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int ans[n][m];
  for (int y = 0; y < n; y++)
    for (int x = 0; x < m; x++) ans[y][x] = 0;
  vector<vector<int>> v;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 3) {
      int x, y, z;
      cin >> y >> x >> z;
      x--;
      y--;
      v.push_back({3, x, y, z});
    } else {
      int x;
      cin >> x;
      x--;
      v.push_back({t, x, 0, 0});
    }
  }
  reverse(v.begin(), v.end());
  for (int i = 0; i < q; i++) {
    int t = v[i][0], x = v[i][1], y = v[i][2], z = v[i][3];
    if (t == 3) {
      ans[y][x] = z;
    } else if (t == 1) {
      int c = ans[x][m - 1];
      for (int i = m - 1; i > 0; i--) ans[x][i] = ans[x][i - 1];
      ans[x][0] = c;
    } else {
      int c = ans[n - 1][x];
      for (int i = n - 1; i > 0; i--) ans[i][x] = ans[i - 1][x];
      ans[0][x] = c;
    }
  }
  for (int y = 0; y < n; y++) {
    for (int x = 0; x < m; x++) {
      cout << ans[y][x] << " ";
    }
    cout << endl;
  }
}
