#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, m, q, t, r, c, x;
int R[N], C[N], ans[N][N];
pair<int, pair<int, int> > arr[N][N], temp[N];
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      arr[i][j].second.first = i;
      arr[i][j].second.second = j;
    }
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &r);
      r--;
      for (int i = 0; i < m; i++) temp[(i - 1 + m) % m] = arr[r][i];
      for (int i = 0; i < m; i++) arr[r][i] = temp[i];
    }
    if (t == 2) {
      scanf("%d", &c);
      c--;
      for (int i = 0; i < n; i++) temp[(i - 1 + n) % n] = arr[i][c];
      for (int i = 0; i < n; i++) arr[i][c] = temp[i];
    }
    if (t == 3) {
      scanf("%d %d %d", &r, &c, &x);
      r--;
      c--;
      arr[r][c].first = x;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      ans[arr[i][j].second.first][arr[i][j].second.second] = arr[i][j].first;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
