#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int mp[maxn][maxn];
int n, m, k;
struct Node {
  int a, b, c, d;
} q[maxn * maxn];
void solve1(int x) {
  int temp = mp[x][m];
  for (int i = m; i >= 2; i--) mp[x][i] = mp[x][i - 1];
  mp[x][1] = temp;
}
void solve2(int x) {
  int temp = mp[n][x];
  for (int i = n; i >= 2; i--) mp[i][x] = mp[i - 1][x];
  mp[1][x] = temp;
}
void solve3(int x, int y, int z) { mp[x][y] = z; }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &q[i].a);
    if (q[i].a == 1 || q[i].a == 2) scanf("%d", &q[i].b);
    if (q[i].a == 3) scanf("%d%d%d", &q[i].b, &q[i].c, &q[i].d);
  }
  for (int i = k; i >= 1; i--) {
    if (q[i].a == 1) solve1(q[i].b);
    if (q[i].a == 2) solve2(q[i].b);
    if (q[i].a == 3) solve3(q[i].b, q[i].c, q[i].d);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", mp[i][j]);
    printf("\n");
  }
}
