#include <bits/stdc++.h>
using namespace std;
long long ans[100][100];
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  vector<int> zaps[k];
  long long k1, k2, k3, k4;
  for (int i = k - 1; i >= 0; i--) {
    cin >> k1 >> k2;
    zaps[i].push_back(k1);
    zaps[i].push_back(k2);
    if (k1 == 3) {
      cin >> k3 >> k4;
      zaps[i].push_back(k3);
      zaps[i].push_back(k4);
    }
  }
  for (int i = 0; i < k; i++) {
    if (zaps[i][0] == 3) {
      ans[zaps[i][1] - 1][zaps[i][2] - 1] = zaps[i][3];
    }
    int r = zaps[i][1] - 1;
    if (zaps[i][0] == 2) {
      int last = ans[n - 1][r];
      for (int lol = n - 1; lol > 0; lol--) {
        ans[lol][r] = ans[lol - 1][r];
      }
      ans[0][r] = last;
    }
    if (zaps[i][0] == 1) {
      int last = ans[r][m - 1];
      for (int lol = m - 1; lol > 0; lol--) {
        ans[r][lol] = ans[r][lol - 1];
      }
      ans[r][0] = last;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
