#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int Q[10010][5];
int n, m, q;
void moveLine(int k) {
  int first = a[k][m - 1];
  for (int i = m - 2; i >= 0; i--) {
    a[k][i + 1] = a[k][i];
  }
  a[k][0] = first;
  return;
}
void moveColumn(int k) {
  int first = a[n - 1][k];
  for (int i = n - 2; i >= 0; i--) {
    a[i + 1][k] = a[i][k];
  }
  a[0][k] = first;
  return;
}
int main() {
  memset(a, 0, sizeof a);
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t < 3) {
      Q[i][0] = t;
      cin >> Q[i][1];
      Q[i][1]--;
    } else {
      Q[i][0] = t;
      cin >> Q[i][1] >> Q[i][2] >> Q[i][3];
      Q[i][1]--;
      Q[i][2]--;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (Q[i][0] == 3) {
      a[Q[i][1]][Q[i][2]] = Q[i][3];
    }
    if (Q[i][0] == 1) {
      moveLine(Q[i][1]);
    }
    if (Q[i][0] == 2) {
      moveColumn(Q[i][1]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
