#include <bits/stdc++.h>
using namespace std;
void in() {}
int mat[500][500];
pair<int, pair<int, int> > p[500][500];
int main() {
  in();
  int n, m, q, t, t1, t2, t3;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) p[i][j] = {i, {j, 0}};
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &t1);
      auto temp = p[t1][1];
      for (int i = 1; i < m; ++i) p[t1][i] = p[t1][i + 1];
      p[t1][m] = temp;
    } else if (t == 2) {
      scanf("%d", &t1);
      auto temp = p[1][t1];
      for (int i = 1; i < n; ++i) p[i][t1] = p[i + 1][t1];
      p[n][t1] = temp;
    } else {
      scanf("%d%d%d", &t1, &t2, &t3);
      p[t1][t2].second.second = t3;
    }
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      mat[p[i][j].first][p[i][j].second.first] = p[i][j].second.second;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) printf("%d ", mat[i][j]);
    printf("\n");
  }
  return 0;
}
