#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
struct point {
  int x, y, value;
  point(int x, int y) : x(x), y(y) { value = 0; }
  point() {
    x = -1;
    y = -1;
    value = 0;
  }
};
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<point>> data(n);
  vector<vector<int>> res(n);
  for (auto i(0); i < n; ++i) {
    data[i].resize(m);
    res[i].resize(m, 0);
    for (auto j(0); j < m; ++j) {
      data[i][j] = point(i, j);
    }
  }
  int type, x, y, val;
  point save;
  for (auto iter(0); iter < q; ++iter) {
    cin >> type;
    if (type == 1) {
      cin >> x;
      --x;
      save = data[x][0];
      for (auto j(0); j < m - 1; ++j) {
        data[x][j] = data[x][j + 1];
      }
      data[x][m - 1] = save;
      continue;
    }
    if (type == 2) {
      cin >> x;
      --x;
      save = data[0][x];
      for (auto j(0); j < n - 1; ++j) {
        data[j][x] = data[j + 1][x];
      }
      data[n - 1][x] = save;
      continue;
    }
    if (type == 3) {
      cin >> x >> y >> val;
      --x;
      --y;
      data[x][y].value = val;
      continue;
    }
  }
  for (auto i(0); i < n; ++i) {
    for (auto j(0); j < m; ++j) {
      res[data[i][j].x][data[i][j].y] = data[i][j].value;
    }
  }
  for (auto i(0); i < n; ++i) {
    for (auto j(0); j < m; ++j) {
      cout << res[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
