#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, i, j, a, b, c, t = 0;
  long long int d;
  vector<int> ins, com;
  cin >> n;
  cin >> m;
  long long int ar[n][m];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) ar[i][j] = 0;
  cin >> q;
  for (i = 0; i < q; i++) {
    cin >> a;
    ins.push_back(a);
    if (a == 3) {
      cin >> b;
      cin >> c;
      cin >> d;
      com.push_back(b);
      com.push_back(c);
      com.push_back(d);
      t += 3;
    } else {
      cin >> b;
      com.push_back(b);
      t += 1;
    }
  }
  for (i = q - 1; i > -1; i--) {
    if (ins[i] == 1) {
      int row = com[t - 1] - 1;
      t--;
      long long int temp = 0;
      for (j = m - 1; j > 0; j--) {
        temp = ar[row][j];
        ar[row][j] = ar[row][j - 1];
        ar[row][j - 1] = temp;
      }
    } else if (ins[i] == 2) {
      int col = com[t - 1] - 1;
      t--;
      long long int temp = 0;
      for (j = n - 1; j > 0; j--) {
        temp = ar[j][col];
        ar[j][col] = ar[j - 1][col];
        ar[j - 1][col] = temp;
      }
    } else {
      ar[com[t - 3] - 1][com[t - 2] - 1] = (long long int)com[t - 1];
      t -= 3;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cout << ar[i][j] << " ";
    cout << endl;
  }
  return 0;
}
