#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
pair<int, int> q[111][111];
int a[111][111];
int n, m, qq;
int main() {
  scanf("%d %d %d", &n, &m, &qq);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      q[i][j] = make_pair(i, j);
    }
  }
  for (int i = 0, type, x, y, r; i < qq; i++) {
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d", &x);
      pair<int, int> c = q[x][1];
      for (int j = 1; j < m; j++) q[x][j] = q[x][j + 1];
      q[x][m] = c;
    } else if (type == 2) {
      scanf("%d", &y);
      pair<int, int> c = q[1][y];
      for (int j = 1; j < n; j++) q[j][y] = q[j + 1][y];
      q[n][y] = c;
    } else {
      scanf("%d %d %d", &x, &y, &r);
      int v1 = q[x][y].first;
      int v2 = q[x][y].second;
      a[v1][v2] = r;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", a[i][j]);
    }
    printf("\n");
  }
  return 0;
}
