#include <bits/stdc++.h>
using namespace std;
int n, m, q;
pair<int, int> from[128][128];
int ans[128][128];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin.sync_with_stdio(0);
  cout.tie(0);
  cout.sync_with_stdio(0);
  cout.precision(9);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      from[i][j] = {i, j};
    }
  }
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      cin >> x;
      --x;
      for (int j = 0; j < m - 1; j++) {
        swap(from[x][j], from[x][j + 1]);
      }
    } else if (t == 2) {
      int y;
      cin >> y;
      --y;
      for (int i = 0; i < n - 1; i++) {
        swap(from[i][y], from[i + 1][y]);
      }
    } else if (t == 3) {
      int x, y, num;
      cin >> x >> y >> num;
      --x, --y;
      ans[from[x][y].first][from[x][y].second] = num;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
