#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX / 2, NINF = INT_MIN / 2;
const long double PI = acos(-1.0);
void prepareIO() {
  if (strlen("") != 0) {
    freopen(
        ""
        ".in",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
}
void debout() {}
template <typename Head, typename... Tail>
void debout(Head H, Tail... T) {}
class Timer {
 public:
  double begin;
  Timer() : begin(clock()) {}
  ~Timer() {
    fprintf(stderr, "%.6lf\n", (clock() - begin + .0) / CLOCKS_PER_SEC);
  }
} timer_;
void solve1();
int main() {
  prepareIO();
  solve1();
  return 0;
}
const int N = 110;
int matrix[N][N];
struct T {
  int type, r, c, x;
} arr[N * N];
void f1(int n, int m, int r) {
  --r;
  int t = matrix[r][m - 1];
  for (int i = m - 1; i >= 1; i--) {
    matrix[r][i] = matrix[r][i - 1];
  }
  matrix[r][0] = t;
}
void f2(int n, int m, int r) {
  --r;
  int t = matrix[n - 1][r];
  for (int i = n - 1; i >= 1; i--) {
    matrix[i][r] = matrix[i - 1][r];
  }
  matrix[0][r] = t;
}
void solve1() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    int type;
    scanf("%d", &type);
    arr[i].type = type;
    int r, c, x;
    if (type <= 2) {
      scanf("%d", &r);
      arr[i].r = r;
    } else {
      scanf("%d %d %d", &r, &c, &x);
      arr[i].r = r;
      arr[i].c = c;
      arr[i].x = x;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (arr[i].type == 3) {
      matrix[arr[i].r - 1][arr[i].c - 1] = arr[i].x;
      continue;
    }
    if (arr[i].type == 1) {
      f1(n, m, arr[i].r);
    } else {
      f2(n, m, arr[i].r);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", matrix[i][j]);
    }
    printf("\n");
  }
}
