#include <bits/stdc++.h>
using namespace std;
int field[100][100];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> vec;
  for (int i = 0; i < q; i++) {
    int type, x, y = 0, v = 0;
    cin >> type >> x;
    x--;
    if (type == 3) {
      cin >> y >> v;
      y--;
    }
    vec.push_back(make_tuple(type, x, y, v));
  }
  for (int i = vec.size() - 1; i >= 0; i--) {
    int t = get<0>(vec[i]), x = get<1>(vec[i]);
    if (t == 3) {
      field[x][get<2>(vec[i])] = get<3>(vec[i]);
    } else {
      if (t == 1) {
        t = field[x][m - 1];
        for (int i = m - 1; i > 0; i--) {
          field[x][i] = field[x][i - 1];
        }
        field[x][0] = t;
      } else {
        t = field[n - 1][x];
        for (int i = n - 1; i > 0; i--) {
          field[i][x] = field[i - 1][x];
        }
        field[0][x] = t;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << field[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
