#include <bits/stdc++.h>
using namespace std;
int a[110][110] = {0};
struct pnt {
  int x, v;
};
int main() {
  long long n, rows, cols, x, y, vx, t, r, c, q;
  cin >> rows >> cols >> q;
  vector<pnt> v;
  pnt tmp;
  for (int i = 0; i < q; ++i) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      tmp.x = 1;
      tmp.v = r;
      v.push_back(tmp);
    } else if (t == 2) {
      cin >> c;
      tmp.x = 2;
      tmp.v = c;
      v.push_back(tmp);
    } else if (t == 3) {
      cin >> x >> y >> vx;
      for (int j = v.size() - 1; j >= 0; --j) {
        if (v[j].x == 1 && v[j].v == x) {
          ++y;
          if (y > cols) y = 1;
        } else if (v[j].x == 2 && v[j].v == y) {
          ++x;
          if (x > rows) x = 1;
        }
      }
      a[x][y] = vx;
    }
  }
  for (int i = 1; i <= rows; ++i) {
    for (int j = 1; j <= cols; ++j) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
