#include <bits/stdc++.h>
using namespace std;
const int N = 200;
pair<int, int> a[N][N];
int val[N][N];
int main() {
  ios::sync_with_stdio(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      a[i][j] = make_pair(i, j);
    }
  }
  for (int i = 1; i <= q; i++) {
    int r, c, x, t;
    cin >> t;
    if (t == 3) {
      cin >> r >> c >> x;
      val[a[r][c].first][a[r][c].second] = x;
    }
    if (t == 1) {
      cin >> r;
      pair<int, int> tmp = a[r][1];
      for (int j = 2; j <= m; j++) {
        a[r][j - 1] = a[r][j];
      }
      a[r][m] = tmp;
    }
    if (t == 2) {
      cin >> c;
      pair<int, int> tmp = a[1][c];
      for (int i = 2; i <= n; i++) {
        a[i - 1][c] = a[i][c];
      }
      a[n][c] = tmp;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << val[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
