#include <bits/stdc++.h>
using namespace std;
int arr[10010][4];
int mat[101][101];
int n, m, q;
void shiftRow(int row) {
  int last = mat[row][m - 1];
  for (int i = m - 1; i > 0; i--) mat[row][i] = mat[row][i - 1];
  mat[row][0] = last;
}
void shiftCol(int col) {
  int last = mat[n - 1][col];
  for (int i = n - 1; i > 0; i--) mat[i][col] = mat[i - 1][col];
  mat[0][col] = last;
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> arr[i][0] >> arr[i][1];
    if (arr[i][0] == 3) cin >> arr[i][2] >> arr[i][3];
  }
  for (int i = q - 1; i >= 0; i--) {
    if (arr[i][0] == 3)
      mat[arr[i][1] - 1][arr[i][2] - 1] = arr[i][3];
    else if (arr[i][0] == 1)
      shiftRow(arr[i][1] - 1);
    else
      shiftCol(arr[i][1] - 1);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << mat[i][j] << " ";
    cout << endl;
  }
  return 0;
}
