#include <bits/stdc++.h>
using namespace std;
struct klp {
  int z, x, y, t;
};
klp a[10010];
int ma[105][105];
int n, m, q, o;
int main() {
  cin >> n >> m >> q;
  while (q--) {
    cin >> a[o].z;
    if (a[o].z == 3) {
      cin >> a[o].x >> a[o].y >> a[o].t;
      o++;
    } else
      cin >> a[o].x, o++;
  }
  for (int i = o - 1; i >= 0; i--) {
    if (a[i].z == 3) ma[a[i].x][a[i].y] = a[i].t;
    if (a[i].z == 2) {
      int aux = ma[n][a[i].x];
      for (int j = n - 1; j >= 0; j--) {
        swap(ma[j + 1][a[i].x], ma[j][a[i].x]);
      }
      ma[1][a[i].x] = aux;
    }
    if (a[i].z == 1) {
      int aux = ma[a[i].x][m];
      for (int j = m - 1; j >= 1; j--) {
        swap(ma[a[i].x][j + 1], ma[a[i].x][j]);
      }
      ma[a[i].x][1] = aux;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << ma[i][j] << " ";
    cout << "\n";
  }
}
