#include <bits/stdc++.h>
using namespace std;
const int mx = 1e4 + 4, mxx = 110;
long long a[mxx][mxx];
bool mark[mx];
int x[mx], r[mx], t[mx], c[mx];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= q; i++) {
    cin >> t[i];
    cin >> r[i];
    if (t[i] == 3) cin >> c[i] >> x[i];
  }
  for (int k = q; k > 0; k--) {
    if (t[k] == 1) {
      for (int i = m; i > 0; i--) {
        a[r[k]][i + 1] = a[r[k]][i];
      }
      a[r[k]][1] = a[r[k]][m + 1];
    }
    if (t[k] == 2) {
      for (int i = n; i > 0; i--) {
        a[i + 1][r[k]] = a[i][r[k]];
      }
      a[1][r[k]] = a[n + 1][r[k]];
    }
    if (t[k] == 3) {
      a[r[k]][c[k]] = x[k];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << endl;
  }
}
