#include <bits/stdc++.h>
using namespace std;
const int nmax = 105;
const int qmax = 10005;
int n, m, q, t;
int a[nmax][nmax];
int op[qmax], r[qmax], c[qmax], x[qmax];
void shift_row(int i) {
  for (int j = m; j > 1; j--) swap(a[i][j], a[i][j - 1]);
}
void shift_column(int j) {
  for (int i = n; i > 1; i--) swap(a[i][j], a[i - 1][j]);
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= q; i++) {
    cin >> op[i];
    if (op[i] == 1) {
      cin >> r[i];
    } else if (op[i] == 2) {
      cin >> c[i];
    } else if (op[i] == 3) {
      cin >> r[i] >> c[i] >> x[i];
    }
  }
  for (int i = q; i >= 1; i--) {
    if (op[i] == 1)
      shift_row(r[i]);
    else if (op[i] == 2)
      shift_column(c[i]);
    else if (op[i] == 3)
      a[r[i]][c[i]] = x[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
