#include <bits/stdc++.h>
using namespace std;
void IOS() { ios_base::sync_with_stdio(0); }
int n, m, q;
int queries[12312][4];
int output[123][123];
void load() {
  cin >> n >> m >> q;
  for (int i = 1; i <= q; ++i) {
    cin >> queries[i][0];
    if (queries[i][0] == 1) {
      cin >> queries[i][1];
    }
    if (queries[i][0] == 2) {
      cin >> queries[i][1];
    }
    if (queries[i][0] == 3) {
      cin >> queries[i][1] >> queries[i][2] >> queries[i][3];
    }
  }
}
void process(int qnum) {
  if (queries[qnum][0] == 1) {
    int r = queries[qnum][1];
    int last = output[r][m];
    for (int i = m - 1; i > 0; --i) output[r][i + 1] = output[r][i];
    output[r][1] = last;
  }
  if (queries[qnum][0] == 2) {
    int c = queries[qnum][1];
    int last = output[n][c];
    for (int i = n - 1; i > 0; --i) output[i + 1][c] = output[i][c];
    output[1][c] = last;
  }
  if (queries[qnum][0] == 3) {
    output[queries[qnum][1]][queries[qnum][2]] = queries[qnum][3];
  }
}
int main() {
  IOS();
  load();
  for (int i = q; i > 0; --i) process(i);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) cout << output[i][j] << " ";
    cout << endl;
  }
}
