#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int t[q], r[q], c[q], d[q];
  for (int i = 0; i < q; i++) {
    cin >> t[i];
    if (t[i] == 1) {
      cin >> r[i];
      r[i]--;
    } else if (t[i] == 2) {
      cin >> c[i];
      c[i]--;
    } else {
      cin >> r[i] >> c[i] >> d[i];
      r[i]--;
      c[i]--;
    }
  }
  int ans[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      ans[i][j] = 0;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == 3) {
      ans[r[i]][c[i]] = d[i];
    } else if (t[i] == 1) {
      int y = r[i];
      int F[m];
      F[0] = ans[y][m - 1];
      for (int j = 1; j < m; j++) {
        F[j] = ans[y][j - 1];
      }
      for (int j = 0; j < m; j++) {
        ans[y][j] = F[j];
      }
    } else {
      int y = c[i];
      int F[n];
      F[0] = ans[n - 1][y];
      for (int j = 1; j < n; j++) {
        F[j] = ans[j - 1][y];
      }
      for (int j = 0; j < n; j++) {
        ans[j][y] = F[j];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
