#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int main() {
  cin >> n >> m >> q;
  vector<vector<int> > tab(n, vector<int>(m, 0));
  vector<int> t(q), r(q), c(q), v(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i];
    if (t[i] == 3) {
      cin >> r[i] >> c[i] >> v[i];
      r[i]--;
      c[i]--;
    } else if (t[i] == 2) {
      cin >> c[i];
      c[i]--;
    } else {
      cin >> r[i];
      r[i]--;
    }
  }
  int cur = q - 1;
  while (cur >= 0 && t[cur] != 3) cur--;
  while (cur >= 0) {
    if (t[cur] == 3) {
      tab[r[cur]][c[cur]] = v[cur];
    } else if (t[cur] == 2) {
      int last = tab[n - 1][c[cur]];
      for (int i = n - 2; i >= 0; i--) tab[i + 1][c[cur]] = tab[i][c[cur]];
      tab[0][c[cur]] = last;
    } else {
      int last = tab[r[cur]][m - 1];
      for (int i = m - 2; i >= 0; i--) tab[r[cur]][i + 1] = tab[r[cur]][i];
      tab[r[cur]][0] = last;
    }
    cur--;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << tab[i][j] << " ";
    cout << "\n";
  }
}
