#include <bits/stdc++.h>
using namespace std;
int mp[130][130];
int op1[100030], op2[100030], op3[100030], op4[100030];
int main() {
  int n, m, k;
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    memset(mp, 0, sizeof(mp));
    for (int i = 0; i < k; i++) {
      scanf("%d", &op1[i]);
      if (op1[i] == 3) {
        scanf("%d%d%d", &op2[i], &op3[i], &op4[i]);
      } else {
        scanf("%d", &op2[i]);
      }
    }
    for (int i = k - 1; i >= 0; i--) {
      if (op1[i] == 2) {
        int c = op2[i];
        int tmp = mp[n][c];
        for (int j = n; j >= 0; j--) mp[j][c] = mp[j - 1][c];
        mp[1][c] = tmp;
      } else if (op1[i] == 1) {
        int r = op2[i];
        int tmp = mp[r][m];
        for (int j = m; j >= 0; j--) mp[r][j] = mp[r][j - 1];
        mp[r][1] = tmp;
      } else {
        int r = op2[i], c = op3[i];
        mp[r][c] = op4[i];
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        printf("%d", mp[i][j]);
        if (j != m)
          printf(" ");
        else
          printf("\n");
      }
    }
  }
}
