#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int X, Y, Q;
  cin >> Y >> X >> Q;
  int a[100][100], b[100][100] = {0};
  for (int y = 0; y < Y; ++y)
    for (int x = 0; x < X; ++x) {
      a[y][x] = y * 100 + x;
    }
  for (int q = 0; q < Q; ++q) {
    int ti;
    cin >> ti;
    if (ti == 1) {
      int r;
      cin >> r;
      --r;
      int tmp = a[r][0];
      for (int i = 0; i < X; ++i) a[r][i] = a[r][(i + 1) % X];
      a[r][X - 1] = tmp;
    } else if (ti == 2) {
      int c;
      cin >> c;
      --c;
      int tmp = a[0][c];
      for (int i = 0; i < Y; ++i) a[i][c] = a[(i + 1) % Y][c];
      a[Y - 1][c] = tmp;
    } else {
      int x, y, v;
      cin >> y >> x >> v;
      --x, --y;
      int xo = a[y][x] % 100;
      int yo = a[y][x] / 100;
      b[yo][xo] = v;
    }
  }
  for (int y = 0; y < Y; ++y) {
    for (int x = 0; x < X; ++x) cout << b[y][x] << " ";
    cout << "\n";
  }
  return 0;
}
