#include <bits/stdc++.h>
using namespace std;
int N, M, Q, A[100][100], B[10000][4], i, j;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M >> Q;
  for (i = 0; i < Q; i++) {
    cin >> B[i][0] >> B[i][1];
    B[i][1]--;
    if (B[i][0] == 3) {
      cin >> B[i][2] >> B[i][3];
      B[i][2]--;
    }
  }
  for (i = Q - 1; i >= 0; i--) {
    if (B[i][0] == 1) {
      for (j = M - 1; j > 0; j--) {
        swap(A[B[i][1]][j], A[B[i][1]][j - 1]);
      }
    } else if (B[i][0] == 2) {
      for (j = N - 1; j > 0; j--) {
        swap(A[j][B[i][1]], A[j - 1][B[i][1]]);
      }
    } else
      A[B[i][1]][B[i][2]] = B[i][3];
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < M; j++) {
      cout << A[i][j] << ' ';
    }
    cout << '\n';
  }
}
