#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9;
const int inf = (int)1e9 + 5;
const int base = 1000 * 1000 * 1000;
const int maxn = 50005;
const long double pi = acosl(-1.0);
const long double eps = 1e-9;
void error() { exit(1); }
void solve() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  vector<vector<int>> d(n, vector<int>(m, 0));
  vector<int> t(q);
  vector<int> x(q);
  vector<int> y(q);
  vector<int> val(q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &t[i]);
    if (t[i] == 1 || t[i] == 3) scanf("%d", &y[i]);
    if (t[i] == 2 || t[i] == 3) scanf("%d", &x[i]);
    if (t[i] == 3) scanf("%d", &val[i]);
  }
  reverse(t.begin(), t.end());
  reverse(x.begin(), x.end());
  reverse(y.begin(), y.end());
  reverse(val.begin(), val.end());
  for (int i = 0; i < q; i++) {
    if (t[i] == 1) {
      y[i]--;
      int cnt = d[y[i]][m - 1];
      for (int j = m - 1; j >= 1; j--) d[y[i]][j] = d[y[i]][j - 1];
      d[y[i]][0] = cnt;
    }
    if (t[i] == 2) {
      x[i]--;
      int cnt = d[n - 1][x[i]];
      for (int j = n - 1; j >= 1; j--) d[j][x[i]] = d[j - 1][x[i]];
      d[0][x[i]] = cnt;
    }
    if (t[i] == 3) {
      x[i]--, y[i]--;
      d[y[i]][x[i]] = val[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%d ", d[i][j]);
    printf("\n");
  }
}
int main() {
  solve();
  return 0;
}
