#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
double eps = 1e-10;
using namespace std;
int n, m, q, ans[200][200];
pair<int, int> now[200][200], cor[200][200];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      now[i][j] = {i, j};
      cor[i][j] = {i, j};
    }
  for (int i = 1; i <= q; i++) {
    int type, x, y, val;
    cin >> type;
    if (type == 1) {
      cin >> x;
      pair<int, int> tmp = now[x][1];
      for (int j = 1; j < m; j++) now[x][j] = now[x][j + 1];
      now[x][m] = tmp;
      for (int j = 1; j <= m; j++)
        cor[now[x][j].first][now[x][j].second] = {x, j};
    }
    if (type == 2) {
      cin >> x;
      pair<int, int> tmp = now[1][x];
      for (int j = 1; j < n; j++) now[j][x] = now[j + 1][x];
      now[n][x] = tmp;
      for (int j = 1; j <= n; j++)
        cor[now[j][x].first][now[j][x].second] = {j, x};
    }
    if (type == 3) {
      cin >> x >> y >> val;
      ans[now[x][y].first][now[x][y].second] = val;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ans[i][j] << " ";
    }
    puts("");
  }
}
