#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int a[110][110];
struct Node {
  int type, r, c, x;
} p[10010];
int main() {
  int n, m, q;
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= q; i++) {
    int op = read();
    if (op == 3) {
      p[i].type = 3;
      p[i].r = read();
      p[i].c = read();
      p[i].x = read();
    }
    if (op == 2) {
      p[i].type = 2;
      p[i].c = read();
    }
    if (op == 1) {
      p[i].type = 1;
      p[i].r = read();
    }
  }
  for (int i = q; i >= 1; i--) {
    if (p[i].type == 1) {
      int row = p[i].r;
      int t = a[row][m];
      for (int i = m; i >= 2; i--) a[row][i] = a[row][i - 1];
      a[row][1] = t;
    }
    if (p[i].type == 2) {
      int col = p[i].c;
      int t = a[n][col];
      for (int i = n; i >= 2; i--) a[i][col] = a[i - 1][col];
      a[1][col] = t;
    }
    if (p[i].type == 3) a[p[i].r][p[i].c] = p[i].x;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    puts("");
  }
  return 0;
}
