#include <bits/stdc++.h>
using namespace std;
struct obj {
  int r, c, x;
};
obj mat[101][101];
int n, m, q;
pair<int, int> pos[101][101];
void shiftRow(int r);
void shiftCol(int c);
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      mat[i][j].r = i;
      mat[i][j].c = j;
      mat[i][j].x = 0;
      pos[i][j].first = i;
      pos[i][j].second = j;
    }
  }
  while (q--) {
    int t, r, c, x;
    cin >> t;
    if (t == 1) {
      cin >> r;
      shiftRow(r - 1);
    } else if (t == 2) {
      cin >> c;
      shiftCol(c - 1);
    } else {
      cin >> r >> c >> x;
      mat[r - 1][c - 1].x = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      pair<int, int> ind = pos[i][j];
      cout << mat[ind.first][ind.second].x << " ";
    }
    cout << "\n";
  }
  return 0;
}
void shiftRow(int r) {
  obj prev, temp;
  prev = mat[r][m - 1];
  for (int i = m - 1; i >= 0; i--) {
    temp = mat[r][(i - 1 + m) % m];
    mat[r][(i - 1 + m) % m] = prev;
    pos[prev.r][prev.c].first = r;
    pos[prev.r][prev.c].second = (i - 1 + m) % m;
    prev = temp;
  }
}
void shiftCol(int c) {
  obj prev, temp;
  prev = mat[n - 1][c];
  for (int i = n - 1; i >= 0; i--) {
    temp = mat[(i - 1 + n) % n][c];
    mat[(i - 1 + n) % n][c] = prev;
    pos[prev.r][prev.c].first = (i - 1 + n) % n;
    pos[prev.r][prev.c].second = c;
    prev = temp;
  }
}
