#include <bits/stdc++.h>
using namespace std;
const int mx = 127;
int ar[mx][mx];
struct node {
  int ty, v1, v2, v3;
};
int main() {
  int n, m, q, hand;
  while (cin >> n >> m >> q) {
    memset(ar, 0, sizeof ar);
    vector<node> vec(q);
    for (auto &x : vec) {
      cin >> x.ty >> x.v1;
      if (x.ty == 3) cin >> x.v2 >> x.v3;
    }
    reverse(vec.begin(), vec.end());
    for (auto x : vec) {
      if (x.ty == 3) {
        ar[x.v1][x.v2] = x.v3;
      } else if (x.ty == 2) {
        hand = ar[n][x.v1];
        for (int i = n - 1; i >= 1; i--) {
          ar[i + 1][x.v1] = ar[i][x.v1];
        }
        ar[1][x.v1] = hand;
      } else {
        hand = ar[x.v1][m];
        for (int i = m - 1; i >= 1; i--) {
          ar[x.v1][i + 1] = ar[x.v1][i];
        }
        ar[x.v1][1] = hand;
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cout << ar[i][j] << " \n"[j == m];
      }
    }
  }
  return 0;
}
