#include <bits/stdc++.h>
using namespace std;
const int maxn = 109;
int mat[maxn][maxn], t[maxn * maxn], a[maxn * maxn], b[maxn * maxn],
    c[maxn * maxn];
int n, m, Q, tmp;
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &t[i], &a[i]);
    if (t[i] == 3) scanf("%d%d", &b[i], &c[i]);
  }
  for (int i = Q; i >= 1; i--)
    if (t[i] == 3)
      mat[a[i]][b[i]] = c[i];
    else if (t[i] == 1) {
      tmp = mat[a[i]][m];
      for (int j = m; j >= 2; j--) mat[a[i]][j] = mat[a[i]][j - 1];
      mat[a[i]][1] = tmp;
    } else if (t[i] == 2) {
      tmp = mat[n][a[i]];
      for (int j = n; j >= 2; j--) mat[j][a[i]] = mat[j - 1][a[i]];
      mat[1][a[i]] = tmp;
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", mat[i][j]);
    puts("");
  }
  return 0;
}
