#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int ans[200][200];
vector<int> vec[4];
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    vec[0].push_back(t);
    if (t == 1) {
      int r;
      cin >> r;
      r--;
      vec[1].push_back(r);
      vec[2].push_back(-1);
      vec[3].push_back(-1);
      int b[200];
      for (int j = 0; j < m; j++) b[j] = ans[r][j];
      for (int j = 0; j < m; j++) ans[r][j] = b[(j + 1) % m];
    }
    if (t == 2) {
      int c;
      cin >> c;
      c--;
      vec[1].push_back(c);
      vec[2].push_back(-1);
      vec[3].push_back(-1);
      int b[200];
      for (int j = 0; j < n; j++) b[j] = ans[j][c];
      for (int j = 0; j < n; j++) ans[j][c] = b[(j + 1) % n];
    }
    if (t == 3) {
      int x, y, c;
      cin >> x >> y >> c;
      x--;
      y--;
      vec[1].push_back(x);
      vec[2].push_back(y);
      vec[3].push_back(c);
      ans[x][y] = c;
    }
  }
  for (int i = vec[0].size() - 1; i >= 0; i--) {
    int t = vec[0][i];
    if (t == 1) {
      int r;
      r = vec[1][i];
      int b[200];
      for (int j = 0; j < m; j++) b[j] = ans[r][j];
      for (int j = 0; j < m; j++) ans[r][(j + 1) % m] = b[j];
    }
    if (t == 2) {
      int c;
      c = vec[1][i];
      int b[200];
      for (int j = 0; j < n; j++) b[j] = ans[j][c];
      for (int j = 0; j < n; j++) ans[(j + 1) % n][c] = b[j];
    }
    if (t == 3) {
      continue;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << ' ';
    }
    cout << endl;
  }
}
