#include <bits/stdc++.h>
using namespace std;
struct que {
  int id;
  int type;
  int r;
  int c;
  int val;
  que(int T, int R, int C, int VAL) {
    type = T;
    r = R;
    c = C;
    val = VAL;
  }
  que(int T, int X) {
    type = T;
    if (type == 1)
      r = X;
    else
      c = X;
  }
};
class ProblemCLittleArtemAndMatrix {
 public:
  int res[101][101];
  int n, m, q;
  void right(int row) {
    int temp = res[row][m];
    for (int i = m; i > 1; --i) res[row][i] = res[row][i - 1];
    res[row][1] = temp;
  }
  void down(int col) {
    int temp = res[n][col];
    for (int i = n; i > 1; --i) res[i][col] = res[i - 1][col];
    res[1][col] = temp;
  }
  void solve(std::istream& in, std::ostream& out) {
    in >> n >> m >> q;
    memset(res, 0, sizeof(res));
    vector<struct que> arr;
    for (int i = 0; i < q; ++i) {
      int t;
      in >> t;
      if (t == 3) {
        int r, c, val;
        in >> r >> c >> val;
        arr.emplace_back(t, r, c, val);
      } else {
        int rc;
        in >> rc;
        arr.emplace_back(t, rc);
      }
    }
    for (int i = q - 1; i >= 0; --i) {
      if (arr[i].type == 3) {
        res[arr[i].r][arr[i].c] = arr[i].val;
      } else if (arr[i].type == 1) {
        right(arr[i].r);
      } else
        down(arr[i].c);
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        out << res[i][j] << ' ';
      }
      out << '\n';
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ProblemCLittleArtemAndMatrix solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
