#include <bits/stdc++.h>
using namespace std;
int a[101][101];
int q[100001][5];
int temp = -2000000000;
int n, m, qn;
void vertical(int pos) {
  int t = a[n - 1][pos];
  for (int i = n - 1; i > 0; i--) {
    a[i][pos] = a[i - 1][pos];
  }
  a[0][pos] = t;
}
void horizontal(int pos) {
  int t = a[pos][m - 1];
  for (int i = m - 1; i > 0; i--) {
    a[pos][i] = a[pos][i - 1];
  }
  a[pos][0] = t;
}
void set_this(int r, int c, int v) { a[r][c] = v; }
int main() {
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      a[i][j] = temp;
    }
  }
  scanf("%d %d %d", &n, &m, &qn);
  for (int i = 0; i < qn; i++) {
    int t;
    scanf("%d", &t);
    q[i][0] = t;
    if (t == 1) {
      scanf("%d", &q[i][1]);
    } else if (t == 2) {
      scanf("%d", &q[i][1]);
    } else {
      scanf("%d %d %d", &q[i][1], &q[i][2], &q[i][3]);
    }
  }
  for (int i = qn - 1; i >= 0; i--) {
    if (q[i][0] == 1) {
      horizontal(q[i][1] - 1);
    } else if (q[i][0] == 2) {
      vertical(q[i][1] - 1);
    } else {
      set_this(q[i][1] - 1, q[i][2] - 1, q[i][3]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!(a[i][j] == temp))
        printf("%d ", a[i][j]);
      else
        printf("42 ");
    }
    printf("\n");
  }
  return 0;
}
