#include <bits/stdc++.h>
using namespace std;
struct point {
  int zn, first, second;
  point(int e, int r, int y) {
    zn = e;
    first = r;
    second = y;
  }
  point() {
    zn = 0;
    first = 0;
    second = 0;
  }
};
const int MAXN = (int)1e2 + 7;
const int bad = -1000000;
point t[MAXN][MAXN];
int ans[MAXN][MAXN];
int n, m, q;
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      t[i][j] = point(0, i, j);
    }
  }
  for (; q > 0; q--) {
    int type, x, y, z;
    cin >> type;
    if (type == 1) {
      cin >> x;
      x--;
      point cop = t[x][0];
      for (int i = 1; i < m; i++) t[x][i - 1] = t[x][i];
      t[x][m - 1] = cop;
    }
    if (type == 2) {
      cin >> y;
      y--;
      point cop = t[0][y];
      for (int i = 1; i < n; i++) t[i - 1][y] = t[i][y];
      t[n - 1][y] = cop;
    }
    if (type == 3) {
      cin >> x >> y >> z;
      x--;
      y--;
      t[x][y].zn = z;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int x = t[i][j].first, y = t[i][j].second;
      ans[x][y] = t[i][j].zn;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
