#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int> > p;
int res[100 + 10][100 + 10];
int main() {
  int n, m, q, k, d, t, tem1, tem2, tem3, tem4, y = 1, sum = 0, ans = 0;
  string s, c;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      p[{i, j}] = {i, j};
    }
  }
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &tem1, &tem2);
    tem2--;
    if (tem1 != 3) {
      if (tem1 == 1) {
        pair<int, int> here = p[{tem2, 0}];
        for (int j = 0; j < m - 1; j++) {
          p[{tem2, j}] = p[{tem2, j + 1}];
        }
        p[{tem2, m - 1}] = here;
      } else {
        pair<int, int> here = p[{0, tem2}];
        for (int j = 0; j < n - 1; j++) {
          p[{j, tem2}] = p[{j + 1, tem2}];
        }
        p[{n - 1, tem2}] = here;
      }
    } else {
      scanf("%d%d", &tem3, &tem4);
      tem3--;
      pair<int, int> here = p[{tem2, tem3}];
      res[here.first][here.second] = tem4;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", res[i][j]);
    }
    printf("\n");
  }
  return 0;
}
