#include <bits/stdc++.h>
using namespace std;
class wonderMatrix {
  int n, m;
  int** mass;
  int* stringPtr;
  int* stolbPtr;

 public:
  wonderMatrix(int n, int m) {
    this->n = n;
    this->m = m;
    mass = (int**)calloc(n, sizeof(int));
    for (int i = 0; i < n; i++) mass[i] = (int*)calloc(m, sizeof(int));
  }
  void initMass() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        mass[i][j] = 0;
      }
    }
  }
  void printMatrix() {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << mass[i][j] << " ";
      }
      cout << endl;
    }
    cout << endl;
  }
  void sdvigSTOLB(int stol, int how) {
    int temp;
    while (how--) {
      temp = mass[n - 1][stol];
      for (int i = n - 2; i >= 0; i--) {
        mass[i + 1][stol] = mass[i][stol];
      }
      mass[0][stol] = temp;
    }
  }
  void sdvigSTROK(int str, int how) {
    int temp;
    while (how--) {
      temp = mass[str][m - 1];
      for (int i = m - 2; i >= 0; i--) {
        mass[str][i + 1] = mass[str][i];
      }
      mass[str][0] = temp;
    }
  }
  void setEl(int n, int m, int x) { mass[n][m] = x; }
};
struct st {
  int col, a, b, c;
};
int main() {
  int n, m, zap;
  cin >> n >> m >> zap;
  wonderMatrix wm(n, m);
  vector<st> vec;
  while (zap--) {
    st ss;
    cin >> ss.col;
    if (ss.col == 3) {
      cin >> ss.a >> ss.b >> ss.c;
    } else
      cin >> ss.a;
    vec.push_back(ss);
  }
  for (int i = vec.size() - 1; i >= 0; i--) {
    if (vec[i].col == 1) {
      wm.sdvigSTROK(vec[i].a - 1, 1);
    } else if (vec[i].col == 2) {
      wm.sdvigSTOLB(vec[i].a - 1, 1);
    } else {
      wm.setEl(vec[i].a - 1, vec[i].b - 1, vec[i].c);
    }
  }
  wm.printMatrix();
}
