#include <bits/stdc++.h>
using namespace std;
const int maxn = 102;
int ans[maxn][maxn], n, m, q;
pair<int, int> pos[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) pos[i][j] = {i, j};
  while (q--) {
    int a, b, r, c, v;
    cin >> a;
    if (a == 1) {
      cin >> r;
      pair<int, int> p = pos[r][1];
      for (int i = 1; i <= m - 1; i++) pos[r][i] = pos[r][i + 1];
      pos[r][m] = p;
    } else if (a == 2) {
      cin >> c;
      pair<int, int> p = pos[1][c];
      for (int i = 1; i <= n - 1; i++) pos[i][c] = pos[i + 1][c];
      pos[n][c] = p;
    } else {
      cin >> r >> c >> v;
      ans[pos[r][c].first][pos[r][c].second] = v;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << ans[i][j] << " ";
    cout << "\n";
  }
  return 0;
}
