#include <bits/stdc++.h>
using namespace std;
const int MAXN = 112;
int ans[MAXN][MAXN];
pair<int, int> a[MAXN][MAXN];
int main() {
  int n, m, q, i, j, x, y, r, c;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &q);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      a[i][j].first = i;
      a[i][j].second = j;
    }
  memset(ans, 0, sizeof(ans));
  while (q--) {
    scanf("%d", &x);
    if (x == 1) {
      scanf("%d", &y);
      pair<int, int> temp = a[y][1];
      for (j = 1; j <= m - 1; j++) a[y][j] = a[y][j + 1];
      a[y][m] = temp;
    } else if (x == 2) {
      scanf("%d", &y);
      pair<int, int> temp = a[1][y];
      for (i = 1; i <= n - 1; i++) a[i][y] = a[i + 1][y];
      a[n][y] = temp;
    } else {
      scanf("%d", &r);
      scanf("%d", &c);
      scanf("%d", &y);
      pair<int, int> temp = a[r][c];
      ans[temp.first][temp.second] = y;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m - 1; j++) printf("%d ", ans[i][j]);
    printf("%d\n", ans[i][m]);
  }
  return 0;
}
