#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long double PI = acosl((long double)-1.0);
const int MOD = 1000000007;
const int MAXN = 105;
int matr[MAXN][MAXN];
pair<int, int> cur[MAXN][MAXN];
int n, m, k;
void solve() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cur[i][j] = pair<int, int>(i, j);
    }
  }
  for (int i = 1; i <= k; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int r;
      scanf("%d", &r);
      pair<int, int> f = cur[r][1];
      for (int j = 1; j < m; j++) {
        cur[r][j] = cur[r][j + 1];
      }
      cur[r][m] = f;
    } else if (t == 2) {
      int c;
      scanf("%d", &c);
      pair<int, int> f = cur[1][c];
      for (int j = 1; j < n; j++) {
        cur[j][c] = cur[j + 1][c];
      }
      cur[n][c] = f;
    } else if (t == 3) {
      int r, c, x;
      scanf("%d%d%d", &r, &c, &x);
      matr[cur[r][c].first][cur[r][c].second] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", matr[i][j]);
    }
    printf("\n");
  }
}
int main() {
  srand(1313);
  solve();
  return 0;
}
