#include <bits/stdc++.h>
using namespace std;
int x[15000];
int y[15000];
int v[15000];
int z[15000];
int t[15000];
int a[110][110];
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", t + i);
    if (t[i] == 3)
      scanf("%d%d%d", x + i, y + i, v + i);
    else
      scanf("%d", z + i);
  }
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == 3)
      a[x[i] - 1][y[i] - 1] = v[i];
    else if (t[i] == 1) {
      int row = z[i] - 1;
      int temp = a[row][m - 1];
      for (int i = m - 1; i > 0; i--) a[row][i] = a[row][i - 1];
      a[row][0] = temp;
    } else {
      int column = z[i] - 1;
      int temp = a[n - 1][column];
      for (int j = n - 1; j > 0; j--) a[j][column] = a[j - 1][column];
      a[0][column] = temp;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) printf("%d%c", a[i][j], " \n"[j == m - 1]);
  return 0;
}
