#include <bits/stdc++.h>
using namespace std;
int mat[105][105];
int main() {
  int n, m, q, Q;
  cin >> n >> m >> q;
  Q = q;
  stringstream is;
  vector<string> s(q);
  getchar();
  while (q--) {
    getline(cin, s[q]);
  }
  for (int i = 0; i < Q; ++i) is << s[i] << " ";
  while (Q--) {
    int t, x, y, z, tmp;
    is >> t >> x;
    if (t == 1) {
      tmp = mat[x][m];
      for (int i = m; i > 1; --i) mat[x][i] = mat[x][i - 1];
      mat[x][1] = tmp;
    } else if (t == 2) {
      tmp = mat[n][x];
      for (int i = n; i > 1; --i) mat[i][x] = mat[i - 1][x];
      mat[1][x] = tmp;
    } else if (t == 3) {
      is >> y >> z;
      mat[x][y] = z;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) cout << mat[i][j] << " ";
    cout << '\n';
  }
}
