#include <bits/stdc++.h>
using namespace std;
int s[105][105];
pair<int, int> a[105][105], z;
int main() {
  int n, m, t, i, j, x, y;
  scanf("%d%d%d", &n, &m, &t);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = make_pair(i, j);
  while (t--) {
    scanf("%d%d", &i, &x);
    if (i == 1) {
      for (z = a[x][j = 1]; j < m; j++) a[x][j] = a[x][j + 1];
      a[x][j] = z;
    } else if (i == 2) {
      for (z = a[j = 1][x]; j < n; j++) a[j][x] = a[j + 1][x];
      a[j][x] = z;
    } else {
      scanf("%d", &y);
      scanf("%d", &s[a[x][y].first][a[x][y].second]);
    }
  }
  for (i = 1; i <= n; i++, puts(""))
    for (j = 1; j <= m; j++) printf("%d ", s[i][j]);
  return 0;
}
