#include <bits/stdc++.h>
using namespace std;
int yt = 1;
bool qf = false;
int a[109][109];
pair<int, int> temp[109][109];
int main() {
  int i, j, n, m, q, ch;
  scanf("%d%d%d", &n, &m, &q);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      temp[i][j].first = i;
      temp[i][j].second = j;
    }
  }
  int pos, t1, t2, r, c, val;
  while (q--) {
    scanf("%d", &ch);
    if (ch == 1) {
      scanf("%d", &pos);
      pos--;
      t1 = temp[pos][0].first;
      t2 = temp[pos][0].second;
      for (i = 0; i < m - 1; i++) {
        temp[pos][i].first = temp[pos][i + 1].first;
        temp[pos][i].second = temp[pos][i + 1].second;
      }
      temp[pos][m - 1].first = t1;
      temp[pos][m - 1].second = t2;
    } else if (ch == 2) {
      scanf("%d", &pos);
      pos--;
      t1 = temp[0][pos].first;
      t2 = temp[0][pos].second;
      for (i = 0; i < n - 1; i++) {
        temp[i][pos].first = temp[i + 1][pos].first;
        temp[i][pos].second = temp[i + 1][pos].second;
      }
      temp[n - 1][pos].first = t1;
      temp[n - 1][pos].second = t2;
    } else {
      scanf("%d%d%d", &r, &c, &val);
      r--;
      c--;
      a[temp[r][c].first][temp[r][c].second] = val;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) printf("%d ", a[i][j]);
    if (qf == true)
      printf("\n");
    else
      cout << "\n";
  }
  return 0;
}
