#include <bits/stdc++.h>
using namespace std;
long long ans[110][110], n, m;
void strSdv(long long k) {
  long long var, varr;
  varr = ans[k][0];
  for (long long i = 0; i < m - 1; i++) {
    var = ans[k][i + 1];
    ans[k][i + 1] = varr;
    varr = var;
  }
  ans[k][0] = varr;
}
void stSdv(long long k) {
  long long var, varr;
  varr = ans[0][k];
  for (long long i = 0; i < n - 1; i++) {
    var = ans[i + 1][k];
    ans[i + 1][k] = varr;
    varr = var;
  }
  ans[0][k] = varr;
}
int main() {
  long long q, a, ind = 0, zap[10015][10];
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> a;
    if (a == 3) {
      zap[ind][0] = a;
      cin >> zap[ind][1] >> zap[ind][2] >> zap[ind][3];
      ind++;
    } else {
      zap[ind][0] = a;
      cin >> zap[ind][1];
      ind++;
    }
  }
  for (long long i = ind - 1; i >= 0; i--) {
    if (zap[i][0] == 3) {
      ans[zap[i][1] - 1][zap[i][2] - 1] = zap[i][3];
    } else {
      if (zap[i][0] == 1) {
        strSdv(zap[i][1] - 1);
      } else {
        stSdv(zap[i][1] - 1);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
