#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, m, q, row, col, elem;
  cin >> n >> m >> q;
  cin.ignore();
  struct Offset {
    int x, y;
  } offset[n][m], tmp;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      offset[i][j].x = i;
      offset[i][j].y = j;
    }
  int orig[n][m];
  memset(orig, 0, sizeof orig);
  string test;
  for (k = 0; k < q; k++) {
    getline(cin, test, ' ');
    switch (test[0]) {
      case '1':
        cin >> row;
        tmp = offset[--row][0];
        for (i = 0; i < m - 1; i++) offset[row][i] = offset[row][i + 1];
        offset[row][m - 1] = tmp;
        break;
      case '2':
        cin >> col;
        tmp = offset[0][--col];
        for (i = 0; i < n - 1; i++) offset[i][col] = offset[i + 1][col];
        offset[n - 1][col] = tmp;
        break;
      case '3':
        cin >> row >> col >> elem;
        --row;
        --col;
        tmp = offset[row][col];
        orig[offset[row][col].x][offset[row][col].y] = elem;
        break;
    }
    cin.ignore();
  }
  for (row = 0; row < n; row++)
    for (col = 0; col < m; col++)
      cout << orig[row][col] << (col < m - 1 ? " " : "\n");
  return 0;
}
