#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 100;
pair<int, int> a[N][N];
int res[N][N];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      a[i][j] = {i, j};
    }
  }
  while (q--) {
    int t, i, j, x;
    scanf("%d", &t);
    if (t == 3) {
      scanf("%d%d%d", &i, &j, &x);
      i--;
      j--;
      res[a[i][j].first][a[i][j].second] = x;
    }
    if (t == 1) {
      scanf("%d", &i);
      i--;
      pair<int, int> b[m];
      for (int w = 0; w < m; w++) {
        b[w] = a[i][(w + 1) % m];
      }
      for (int w = 0; w < m; w++) {
        a[i][w] = b[w];
      }
    }
    if (t == 2) {
      scanf("%d", &j);
      j--;
      pair<int, int> b[n];
      for (int w = 0; w < n; w++) {
        b[w] = a[(w + 1) % n][j];
      }
      for (int w = 0; w < n; w++) {
        a[w][j] = b[w];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", res[i][j]);
    }
    printf("\n");
  }
  return 0;
}
