#include <bits/stdc++.h>
using namespace std;
int gc(int a, int b) {
  if (a == 0) return b;
  return gc(b % a, a);
}
int n, m, q;
int a[105][105], r, c;
int i;
void sol(int u) {
  if (u == 0) return;
  int x, y, el, op, t, prev;
  cin >> t;
  if (t == 1 || t == 2) {
    cin >> op;
  } else {
    cin >> x >> y >> el;
  }
  sol(u - 1);
  if (t == 1) {
    r = op;
    prev = a[r][1];
    for (i = 1; i < m; i++) {
      op = a[r][i + 1];
      a[r][i + 1] = prev;
      prev = op;
    }
    a[r][1] = prev;
  } else if (t == 2) {
    c = op;
    prev = a[1][c];
    for (i = 1; i < n; i++) {
      op = a[i + 1][c];
      a[i + 1][c] = prev;
      prev = op;
    }
    a[1][c] = prev;
  } else if (t == 3) {
    a[x][y] = el;
  }
}
int main() {
  cin >> n >> m >> q;
  sol(q);
  int j, k;
  for (j = 1; j <= n; j++) {
    for (k = 1; k <= m; k++) {
      cout << a[j][k] << " ";
    }
    cout << endl;
  }
  return 0;
}
