#include <bits/stdc++.h>
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
using namespace std;
struct data {
  int x, y;
};
data a[int(2e3 + 100)][int(2e3 + 100)];
int ans[int(2e3 + 100)][int(2e3 + 100)];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) {
      a[i][j].x = i;
      a[i][j].y = j;
    }
  for (int Q = (1); Q <= (q); Q++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x;
      scanf("%d", &x);
      for (int i = (m - 1); i >= (1); i--) swap(a[x][i], a[x][m]);
    }
    if (t == 2) {
      int x;
      scanf("%d", &x);
      for (int i = (n - 1); i >= (1); i--) swap(a[i][x], a[n][x]);
    }
    if (t == 3) {
      int x, y, z;
      scanf("%d%d%d", &x, &y, &z);
      ans[a[x][y].x][a[x][y].y] = z;
    }
  }
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (m); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
}
