#include <bits/stdc++.h>
using namespace std;
const int maxn = 106;
int ma[maxn][maxn];
struct node {
  int t1, t2, t3, t4;
} quer[maxn * maxn];
int main() {
  int n, x, y, z, m, q, sum;
  sum = 0;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= q; ++i) {
    scanf("%d", &x);
    if (x == 1 || x == 2) {
      scanf("%d", &y);
      quer[++sum].t1 = x;
      quer[sum].t2 = y;
    } else {
      quer[++sum].t1 = 3;
      scanf("%d%d%d", &x, &y, &z);
      quer[sum].t2 = x;
      quer[sum].t3 = y;
      quer[sum].t4 = z;
    }
  }
  for (int i = sum; i >= 1; i--) {
    if (quer[i].t1 == 1) {
      x = quer[i].t2;
      int temp = ma[x][m];
      for (int j = m; j >= 2; j--) ma[x][j] = ma[x][j - 1];
      ma[x][1] = temp;
    } else if (quer[i].t1 == 2) {
      x = quer[i].t2;
      int temp = ma[n][x];
      for (int j = n; j >= 2; j--) ma[j][x] = ma[j - 1][x];
      ma[1][x] = temp;
    } else
      ma[quer[i].t2][quer[i].t3] = quer[i].t4;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%d ", ma[i][j]);
    printf("\n");
  }
  return 0;
}
