#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
};
node arr[200][200];
int org[200][200];
int main() {
  ios::sync_with_stdio(false);
  int n, m, q;
  int i, j;
  memset(org, 0, sizeof(org));
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      arr[i][j].x = i;
      arr[i][j].y = j;
    }
  }
  int t, r, c, x;
  node temp;
  int k;
  for (k = 0; k < q; k++) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      temp = arr[r][1];
      for (i = 1; i < m; i++) {
        arr[r][i] = arr[r][i + 1];
      }
      arr[r][m] = temp;
    } else if (t == 2) {
      cin >> c;
      temp = arr[1][c];
      for (i = 1; i < n; i++) {
        arr[i][c] = arr[i + 1][c];
      }
      arr[n][c] = temp;
    } else {
      cin >> r >> c >> x;
      temp = arr[r][c];
      org[temp.x][temp.y] = x;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << org[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
