#include <bits/stdc++.h>
using namespace std;
void csr(int *matrix, int row, int m) {
  int cur, tmp;
  cur = matrix[row * m + (m - 1)];
  for (int i = 0; i < m; i++) {
    tmp = matrix[row * m + i];
    matrix[row * m + i] = cur;
    cur = tmp;
  }
}
void csd(int *matrix, int col, int n, int m) {
  int cur, tmp;
  cur = matrix[(n - 1) * m + col];
  for (int i = 0; i < n; i++) {
    tmp = matrix[i * m + col];
    matrix[i * m + col] = cur;
    cur = tmp;
  }
}
int main() {
  int n, m, q, t;
  int *matrix;
  int *command;
  cin >> n >> m >> q;
  matrix = new int[n * m];
  command = new int[4 * q];
  for (int i = 0; i < n * m; i++) {
    matrix[i] = 0;
  }
  for (int i = 0; i < q; i++) {
    cin >> command[i * 4];
    if (command[i * 4] == 1 || command[i * 4] == 2) {
      cin >> command[i * 4 + 1];
    } else {
      for (int j = 1; j < 4; j++) {
        cin >> command[i * 4 + j];
      }
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (command[i * 4] == 3) {
      int k, j;
      k = command[i * 4 + 1] - 1;
      j = command[i * 4 + 2] - 1;
      matrix[k * m + j] = command[i * 4 + 3];
    } else if (command[i * 4] == 2) {
      csd(matrix, command[i * 4 + 1] - 1, n, m);
    } else {
      csr(matrix, command[i * 4 + 1] - 1, m);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << matrix[i * m + j] << " ";
    }
    cout << endl;
  }
  delete[] command;
  delete[] matrix;
  return 0;
}
