#include <bits/stdc++.h>
using namespace std;
int n, m;
const int MX = 109;
pair<int, int> T[MX][MX];
int ans[MX][MX];
int main() {
  int q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      T[i][j] = pair<int, int>(i, j);
      ans[i][j] = 0;
    }
  }
  for (int tt = 0; tt < q; tt++) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      r--;
      pair<int, int> first = T[r][0];
      for (int j = 0; j < m - 1; j++) {
        T[r][j] = T[r][j + 1];
      }
      T[r][m - 1] = first;
    } else if (t == 2) {
      int c;
      cin >> c;
      c--;
      pair<int, int> first = T[0][c];
      for (int i = 0; i < n - 1; i++) {
        T[i][c] = T[i + 1][c];
      }
      T[n - 1][c] = first;
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      r--;
      c--;
      pair<int, int> p = T[r][c];
      ans[p.first][p.second] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << ans[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
