#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, q, b[10010], a[10010], c[10010], d[10010], aux[200][200];
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 3) cin >> c[i] >> d[i];
  }
  for (int i = q - 1; i >= 0; i--) {
    if (a[i] == 3) {
      aux[b[i]][c[i]] = d[i];
    } else {
      if (a[i] == 1) {
        aux[b[i]][0] = aux[b[i]][m];
        for (int j = m; j > 0; j--) aux[b[i]][j] = aux[b[i]][j - 1];
      } else {
        aux[0][b[i]] = aux[n][b[i]];
        for (int j = n; j > 0; j--) aux[j][b[i]] = aux[j - 1][b[i]];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << aux[i][j] << " ";
    cout << endl;
  }
  return 0;
}
