#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MAXN = (int)1000 + 7;
int n, m, q;
int a[MAXN][MAXN];
int type[MAXN * 10];
int x[MAXN * 10];
int y[MAXN * 10];
int z[MAXN * 10];
void shift_row(int x) {
  int old = a[x][m];
  for (int i = m; i > 1; i--) a[x][i] = a[x][i - 1];
  a[x][1] = old;
}
void shift_col(int x) {
  int old = a[n][x];
  for (int i = n; i > 1; i--) a[i][x] = a[i - 1][x];
  a[1][x] = old;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &type[i]);
    if (type[i] == 1 || type[i] == 2)
      scanf("%d", &x[i]);
    else
      scanf("%d%d%d", &x[i], &y[i], &z[i]);
  }
  for (int i = q; i >= 1; i--) {
    if (type[i] == 1) {
      shift_row(x[i]);
    } else if (type[i] == 2) {
      shift_col(x[i]);
    } else {
      a[x[i]][y[i]] = z[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", a[i][j]);
    puts("");
  }
  return 0;
}
