#include <bits/stdc++.h>
using namespace std;
struct elem {
  int row, col;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<elem> > table(n, vector<elem>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      table[i][j].row = i;
      table[i][j].col = j;
    }
  }
  vector<vector<int> > res(n, vector<int>(m));
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      r--;
      elem first = table[r][0];
      for (int j = 0; j < m - 1; j++) {
        table[r][j] = table[r][j + 1];
      }
      table[r][m - 1] = first;
    } else if (t == 2) {
      int c;
      cin >> c;
      c--;
      elem first = table[0][c];
      for (int j = 0; j < n - 1; j++) {
        table[j][c] = table[j + 1][c];
      }
      table[n - 1][c] = first;
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      r--, c--;
      elem now = table[r][c];
      res[now.row][now.col] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << res[i][j] << ' ';
    }
    cout << "\n";
  }
  return 0;
}
