#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
pair<int, int> a[111][111];
int n, m;
int q;
int ans[111][111];
void query() {
  int t;
  int r, c, x;
  cin >> t;
  if (t == 1) {
    cin >> r;
    r--;
    for (int j = 0; j + 1 < m; j++) {
      swap(a[r][j], a[r][j + 1]);
    }
  } else if (t == 2) {
    cin >> c;
    c--;
    for (int i = 0; i + 1 < n; i++) swap(a[i][c], a[i + 1][c]);
  } else {
    cin >> r >> c >> x;
    r--;
    c--;
    pair<int, int> p = a[r][c];
    ans[p.first][p.second] = x;
  }
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) a[i][j] = make_pair(i, j);
  }
  while (q--) query();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (j) cout << " ";
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}
