#include <bits/stdc++.h>
using namespace std;
int n, m, a[200][200], x, q, r, c;
pair<int, int> qq[200][200];
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < int(n); i++)
    for (int j = 0; j < int(m); j++) qq[i][j] = {i, j};
  for (int i = 0; i < int(q); i++) {
    int p;
    cin >> p >> r;
    r--;
    if (p == 1) {
      pair<int, int> a = qq[r][0];
      for (int i = 0; i + 1 < m; i++) qq[r][i] = qq[r][i + 1];
      qq[r][m - 1] = a;
      continue;
    }
    if (p == 2) {
      pair<int, int> a = qq[0][r];
      for (int i = 0; i + 1 < n; i++) qq[i][r] = qq[i + 1][r];
      qq[n - 1][r] = a;
      continue;
    }
    cin >> c >> x;
    c--;
    a[qq[r][c].first][qq[r][c].second] = x;
  }
  for (int i = 0; i < int(n); i++) {
    for (int j = 0; j < int(m); j++) cout << a[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
