#include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  std::vector<std::vector<int>> req(q);
  std::vector<std::vector<int>> ans(n, std::vector<int>(m, 0));
  for (int i = 0; i < q; ++i) {
    int e;
    scanf("%d", &e);
    req[i].push_back(e);
    if (e == 1 || e == 2) {
      int y;
      scanf("%d", &y);
      req[i].push_back(y - 1);
    } else {
      int x, y, z;
      scanf("%d%d%d", &x, &y, &z);
      req[i].push_back(x - 1);
      req[i].push_back(y - 1);
      req[i].push_back(z);
    }
  }
  for (int i = q - 1; i >= 0; --i) {
    if (req[i][0] == 1) {
      int h = req[i][1];
      int temp = ans[h][m - 1];
      for (int j = m - 1; j >= 1; --j) {
        ans[h][j] = ans[h][j - 1];
      }
      ans[h][0] = temp;
    }
    if (req[i][0] == 2) {
      int h = req[i][1];
      int temp = ans[n - 1][h];
      for (int j = n - 1; j >= 1; --j) {
        ans[j][h] = ans[j - 1][h];
      }
      ans[0][h] = temp;
    }
    if (req[i][0] == 3) {
      ans[req[i][1]][req[i][2]] = req[i][3];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      std::cout << ans[i][j] << ' ';
    }
    std::cout << '\n';
  }
  return 0;
}
