#include <bits/stdc++.h>
using namespace std;
long long con[101][101] = {0};
long long n, m, q;
void shiftrow(long long r) {
  long long temp = con[r][m];
  for (long long i = m; i > 1; i--) {
    con[r][i] = con[r][i - 1];
  }
  con[r][1] = temp;
}
void shiftcol(long long c) {
  long long temp = con[n][c];
  for (long long i = n; i > 1; i--) {
    con[i][c] = con[i - 1][c];
  }
  con[1][c] = temp;
}
int main() {
  cin >> n >> m >> q;
  pair<pair<long long, long long>, pair<long long, long long> > quer[10005];
  for (long long i = 0; i < q; i++) {
    cin >> quer[i].first.first >> quer[i].first.second;
    if (quer[i].first.first == 3) {
      cin >> quer[i].second.first >> quer[i].second.second;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> con[i][j];
    }
  }
  for (long long i = q - 1; i >= 0; i--) {
    if (quer[i].first.first == 1) {
      shiftrow(quer[i].first.second);
      continue;
    }
    if (quer[i].first.first == 2) {
      shiftcol(quer[i].first.second);
      continue;
    }
    con[quer[i].first.second][quer[i].second.first] = quer[i].second.second;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cout << con[i][j] << " ";
    }
    cout << endl;
  }
}
