#include <bits/stdc++.h>
using namespace std;
int a[101][101], n, m, q;
int main() {
  cin >> n >> m >> q;
  vector<vector<int>> A(q, vector<int>(4, 0));
  for (int i = 0; i < q; i++) {
    cin >> A[i][0];
    if (A[i][0] == 3)
      cin >> A[i][1] >> A[i][2] >> A[i][3];
    else
      cin >> A[i][1];
  }
  for (int i = q - 1; i >= 0; i--) {
    int x, y;
    if (A[i][0] == 3)
      a[A[i][1]][A[i][2]] = A[i][3];
    else if (A[i][0] == 1) {
      x = a[A[i][1]][1];
      a[A[i][1]][1] = a[A[i][1]][m];
      for (int u = 2; u <= m; u++) {
        y = a[A[i][1]][u];
        a[A[i][1]][u] = x;
        x = y;
      }
    } else {
      x = a[1][A[i][1]];
      a[1][A[i][1]] = a[n][A[i][1]];
      for (int u = 2; u <= n; u++) {
        y = a[u][A[i][1]];
        a[u][A[i][1]] = x;
        x = y;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int u = 1; u <= m; u++) cout << a[i][u] << ' ';
    cout << endl;
  }
  return 0;
}
