#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int arr[110][110], r[10010], c[10010], v[10010], t[10010];
int main() {
  scanf("%d", &n), scanf("%d", &m), scanf("%d", &q);
  for (int z = 0; z < q; ++z) {
    scanf("%d", &t[z]);
    if (t[z] == 1) scanf("%d", &r[z]);
    if (t[z] == 2) scanf("%d", &c[z]);
    if (t[z] == 3) scanf("%d", &r[z]), scanf("%d", &c[z]), scanf("%d", &v[z]);
  }
  reverse(t, t + q);
  reverse(c, c + q);
  reverse(r, r + q);
  reverse(v, v + q);
  for (int z = 0; z < q; ++z) {
    if (t[z] == 1) {
      --r[z];
      v[z] = arr[r[z]][m - 1];
      for (int j = m - 1; j > 0; --j) arr[r[z]][j] = arr[r[z]][j - 1];
      arr[r[z]][0] = v[z];
    } else if (t[z] == 2) {
      --c[z];
      v[z] = arr[n - 1][c[z]];
      for (int i = n - 1; i > 0; --i) arr[i][c[z]] = arr[i - 1][c[z]];
      arr[0][c[z]] = v[z];
    } else {
      arr[r[z] - 1][c[z] - 1] = v[z];
    }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) printf("%d%c", arr[i][j], " \n"[j == m - 1]);
}
