#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, i, j, broj, one, two, three, krajmatrica[101][101], kod;
  pair<int, int> matrica[101][101];
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      matrica[i][j] = make_pair(0, i * 101 + j);
      krajmatrica[i][j] = 0;
    }
  }
  for (j = 0; j < q; j++) {
    cin >> broj;
    if (broj == 1) {
      cin >> one;
      one--;
      pair<int, int> temp = matrica[one][0];
      for (i = 0; i < m - 1; i++) {
        matrica[one][i] = matrica[one][i + 1];
      }
      matrica[one][m - 1] = temp;
    }
    if (broj == 2) {
      cin >> one;
      one--;
      pair<int, int> temp = matrica[0][one];
      for (i = 0; i < n - 1; i++) {
        matrica[i][one] = matrica[i + 1][one];
      }
      matrica[n - 1][one] = temp;
    }
    if (broj == 3) {
      cin >> one >> two >> three;
      one--;
      two--;
      pair<int, int> temp = matrica[one][two];
      kod = temp.second;
      krajmatrica[kod / 101][kod % 101] = three;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cout << krajmatrica[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
