#include <bits/stdc++.h>
using namespace std;
const int N = 210;
int n, m, q, t, a, b, c, g[N][N], row[N], col[N];
pair<int, pair<int, int> > grid[N][N];
pair<int, pair<int, int> > tmp[N];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      grid[i][j] = make_pair(0, make_pair(i, j));
    }
  }
  for (int i = 0; i < q; ++i) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &a);
      for (int i = 1; i <= m; ++i) {
        int newIdx = i - 1;
        if (newIdx <= 0) newIdx += m;
        tmp[newIdx] = grid[a][i];
      }
      for (int i = 1; i <= m; ++i) {
        grid[a][i] = tmp[i];
      }
    } else if (t == 2) {
      scanf("%d", &a);
      for (int i = 1; i <= n; ++i) {
        int newIdx = i - 1;
        if (newIdx <= 0) newIdx += n;
        tmp[newIdx] = grid[i][a];
      }
      for (int i = 1; i <= n; ++i) {
        grid[i][a] = tmp[i];
      }
    } else if (t == 3) {
      scanf("%d%d%d", &a, &b, &c);
      g[grid[a][b].second.first][grid[a][b].second.second] = c;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (j > 1) printf(" ");
      printf("%d", g[i][j]);
    }
    puts("");
  }
  return 0;
}
