#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long mod = 1e9 + 9;
struct str {
  int t, r, c, x;
};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int> > g(n);
  for (int i = 0; i < n; i++) g[i].resize(m, 0);
  vector<str> z;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 3) {
      int r, c, x;
      cin >> r >> c >> x;
      r--, c--;
      z.push_back({t, r, c, x});
    } else if (t == 1) {
      int r;
      cin >> r;
      r--;
      z.push_back({t, r, -1, -1});
    } else {
      int c;
      cin >> c;
      c--;
      z.push_back({t, -1, c, -1});
    }
  }
  int fl = 0, pt = z.back().t;
  for (int i = z.size() - 1; i > -1; i--) {
    if (z[i].t == 1) {
      vector<int> t;
      for (int j = 0; j < m; j++) t.push_back(g[z[i].r][j]);
      for (int j = 1; j < m; j++) g[z[i].r][j] = t[j - 1];
      g[z[i].r][0] = t.back();
    } else if (z[i].t == 2) {
      vector<int> t;
      for (int j = 0; j < n; j++) t.push_back(g[j][z[i].c]);
      for (int j = 1; j < n; j++) g[j][z[i].c] = t[j - 1];
      g[0][z[i].c] = t.back();
    } else if (z[i].t == 3)
      g[z[i].r][z[i].c] = z[i].x;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << g[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
