#include <bits/stdc++.h>
using namespace std;
long long int x[1005][1005];
int main() {
  int n, m, q;
  int row = 0, col = 0;
  int z[10000];
  int b[10000];
  int d[10000];
  int op[100100];
  int ope[100100];
  cin >> n >> m >> q;
  int t, r, c, v;
  for (int i = 0; i < q; i++) {
    cin >> op[i];
    if (op[i] == 1 || op[i] == 2) {
      cin >> r;
      ope[i] = r;
      row++;
    } else {
      cin >> r >> c >> v;
      z[i] = r;
      b[i] = c;
      d[i] = v;
      col++;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (op[i] == 1) {
      for (int j = m - 1; j > 0; j--) {
        swap(x[ope[i] - 1][j], x[ope[i] - 1][j - 1]);
      }
    } else if (op[i] == 2) {
      for (int j = n - 1; j > 0; j--) {
        swap(x[j][ope[i] - 1], x[j - 1][ope[i] - 1]);
      }
    } else {
      x[z[i] - 1][b[i] - 1] = d[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << x[i][j] << " ";
    }
    cout << endl;
  }
}
