#include <bits/stdc++.h>
using namespace std;
const int maxn = 128;
int n, m, q;
pair<int, int> a[maxn][maxn];
int val[maxn][maxn];
int main() {
  ios::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++) a[i][j] = {i, j};
  for (int t, r, c, x, i = 0; i < q; i++) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      a[r][m + 1] = a[r][1];
      for (int j = 1; j <= m; j++) a[r][j] = a[r][j + 1];
    } else if (t == 2) {
      cin >> c;
      a[n + 1][c] = a[1][c];
      for (int j = 1; j <= n; j++) a[j][c] = a[j + 1][c];
    } else {
      cin >> r >> c >> x;
      val[a[r][c].first][a[r][c].second] = x;
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cout << val[i][j] << " \n"[j == m];
  return 0;
}
