#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, m, q;
  cin >> n >> m >> q;
  vector<tuple<long long, long long, long long, long long>> a((size_t)q,
                                                              {-1, -1, -1, -1});
  for (long long t = 0; t < q; t++) {
    cin >> get<0>(a[t]);
    if (get<0>(a[t]) == 1) {
      cin >> get<1>(a[t]);
      get<1>(a[t])--;
    }
    if (get<0>(a[t]) == 2) {
      cin >> get<1>(a[t]);
      get<1>(a[t])--;
    }
    if (get<0>(a[t]) == 3) {
      cin >> get<1>(a[t]) >> get<2>(a[t]) >> get<3>(a[t]);
      get<1>(a[t])--, get<2>(a[t])--;
    }
  }
  reverse(a.begin(), a.end());
  vector<vector<long long>> b((size_t)n, vector<long long>((size_t)m));
  for (long long t = 0; t < q; t++) {
    if (get<0>(a[t]) == 1) {
      long long j = b[get<1>(a[t])][m - 1];
      for (long long i = m - 1; i >= 1; i--) {
        b[get<1>(a[t])][i] = b[get<1>(a[t])][i - 1];
      }
      b[get<1>(a[t])][0] = j;
    }
    if (get<0>(a[t]) == 2) {
      long long j = b[n - 1][get<1>(a[t])];
      for (long long i = n - 1; i >= 1; i--) {
        b[i][get<1>(a[t])] = b[i - 1][get<1>(a[t])];
      }
      b[0][get<1>(a[t])] = j;
    }
    if (get<0>(a[t]) == 3) {
      b[get<1>(a[t])][get<2>(a[t])] = get<3>(a[t]);
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cout << b[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
