#include <bits/stdc++.h>
using namespace std;
pair<int, int> temp[102][102];
int ans[102][102];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      temp[i][j].first = i;
      temp[i][j].second = j;
    }
  }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      pair<int, int> p;
      p = temp[r][1];
      for (int j = 1; j < m; j++) {
        temp[r][j] = temp[r][j + 1];
      }
      temp[r][m] = p;
    } else if (t == 2) {
      int c;
      cin >> c;
      pair<int, int> p;
      p = temp[1][c];
      for (int j = 1; j < n; j++) {
        temp[j][c] = temp[j + 1][c];
      }
      temp[n][c] = p;
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      int indx1 = temp[r][c].first;
      int indx2 = temp[r][c].second;
      ans[indx1][indx2] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
