#include <bits/stdc++.h>
using namespace std;
int aa[105][105];
pair<int, int> pos[105][105];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      pos[i][j] = {i, j};
      aa[i][j] = INT_MAX;
    }
  }
  for (int l = 1; l <= q; ++l) {
    int a;
    scanf("%d", &a);
    if (a == 3) {
      int r, c, x;
      scanf("%d %d %d", &r, &c, &x);
      aa[pos[r][c].first][pos[r][c].second] = x;
    } else {
      int x;
      scanf("%d", &x);
      if (a == 1) {
        pair<int, int> temp = pos[x][1];
        for (int i = 1; i <= m; ++i) {
          pos[x][i] = pos[x][i + 1];
        }
        pos[x][m] = temp;
      } else {
        pair<int, int> temp = pos[1][x];
        for (int i = 1; i <= n; ++i) {
          pos[i][x] = pos[i + 1][x];
        }
        pos[n][x] = temp;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (aa[i][j] == INT_MAX) {
        printf("1 ");
      } else {
        printf("%d ", aa[i][j]);
      }
    }
    printf("\n");
  }
}
