#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 105;
const int MAX_Q = 10005;
int a[MAX_N][MAX_N];
struct name {
  int t, r, c, x;
};
name s[MAX_Q];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int t, r, c, x;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) a[i][j] = 0;
  for (int i = 0; i < q; i++) {
    cin >> t;
    s[i].t = t;
    if (t == 3) {
      cin >> r >> c >> x;
      r--;
      c--;
      s[i].r = r;
      s[i].c = c;
      s[i].x = x;
    }
    if (t == 2) {
      cin >> c;
      c--;
      s[i].c = c;
    }
    if (t == 1) {
      cin >> r;
      r--;
      s[i].r = r;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (s[i].t == 3) {
      a[s[i].r][s[i].c] = s[i].x;
    }
    if (s[i].t == 2) {
      int b = a[n - 1][s[i].c];
      for (int j = n - 1; j > 0; j--) {
        a[j][s[i].c] = a[j - 1][s[i].c];
      }
      a[0][s[i].c] = b;
    }
    if (s[i].t == 1) {
      int b = a[s[i].r][m - 1];
      for (int j = m - 1; j > 0; j--) {
        a[s[i].r][j] = a[s[i].r][j - 1];
      }
      a[s[i].r][0] = b;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
