#include <bits/stdc++.h>
using namespace std;
int n, m, k, g[105][105];
struct Node {
  int cmd, l, r, val;
} q[10005];
void row_Shift(int x) {
  int tmp[105];
  for (int i = 0; i < m - 1; i++) tmp[i + 1] = g[x][i];
  tmp[0] = g[x][m - 1];
  for (int i = 0; i < m; i++) g[x][i] = tmp[i];
}
void column_Shift(int x) {
  int tmp[105];
  for (int i = 0; i < n - 1; i++) tmp[i + 1] = g[i][x];
  tmp[0] = g[n - 1][x];
  for (int i = 0; i < n; i++) g[i][x] = tmp[i];
}
void echo() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << g[i][j] << " ";
    }
    cout << endl;
  }
}
void get() {
  for (int i = k - 1; i >= 0; i--) {
    switch (q[i].cmd) {
      case 1:
        row_Shift(q[i].val - 1);
        break;
      case 2:
        column_Shift(q[i].val - 1);
        break;
      case 3:
        g[q[i].l - 1][q[i].r - 1] = q[i].val;
        break;
    }
  }
  echo();
}
int main() {
  int cmd, val, l, r;
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    cin >> cmd;
    switch (cmd) {
      case 1:
      case 2:
        cin >> val;
        q[i].val = val;
        break;
      case 3:
        cin >> l >> r >> val;
        q[i].val = val, q[i].l = l, q[i].r = r;
        break;
    }
    q[i].cmd = cmd;
  }
  get();
  return 0;
}
