#include <bits/stdc++.h>
using namespace std;
long long y[101][101];
long long m, n;
long long q;
void row(long long a) {
  a--;
  for (long long i = 1; i < m; i++) {
    swap(y[a][i], y[a][i - 1]);
  }
  return;
}
void col(long long a) {
  a--;
  for (long long i = 1; i < n; i++) {
    swap(y[i][a], y[i - 1][a]);
  }
  return;
}
void row1(long long a) {
  a--;
  for (long long i = m - 2; i >= 0; i--) {
    swap(y[a][i], y[a][i + 1]);
  }
  return;
}
void col1(long long a) {
  a--;
  for (long long i = n - 2; i >= 0; i--) {
    swap(y[i][a], y[i + 1][a]);
  }
  return;
}
int main() {
  cin >> n >> m >> q;
  vector<pair<long long, long long>> v;
  for (long long i = 0; i < q; i++) {
    long long t;
    cin >> t;
    if (t == 1) {
      long long r;
      cin >> r;
      row(r);
      v.push_back({t, r});
    } else if (t == 2) {
      long long coll;
      cin >> coll;
      col(coll);
      v.push_back({t, coll});
    } else {
      long long xx, yy, zz;
      cin >> xx >> yy >> zz;
      y[xx - 1][yy - 1] = zz;
    }
  }
  for (long long i = v.size() - 1; i >= 0; i--) {
    if (v[i].first == 1) {
      row1(v[i].second);
    } else {
      col1(v[i].second);
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cout << y[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
