#include <bits/stdc++.h>
using namespace std;
pair<int, int> mat[105][105];
int ans[105][105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, i, j, q, t, r, c, x;
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) mat[i][j] = {i, j};
  }
  memset(ans, 0, sizeof(ans));
  while (q--) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      pair<int, int> temp = mat[r][1];
      for (i = 1; i < m; i++) mat[r][i] = mat[r][i + 1];
      mat[r][m] = temp;
    } else if (t == 2) {
      cin >> c;
      pair<int, int> temp = mat[1][c];
      for (i = 1; i < n; i++) mat[i][c] = mat[i + 1][c];
      mat[n][c] = temp;
    } else {
      cin >> r >> c >> x;
      ans[mat[r][c].first][mat[r][c].second] = x;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) cout << ans[i][j] << ' ';
    cout << "\n";
  }
  return 0;
}
