#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int A[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) A[i][j] = 0;
  vector<pair<pair<pair<int, int>, int>, int> > Q;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 3) {
      int a, b, c;
      cin >> a >> b >> c;
      Q.push_back(make_pair(make_pair(make_pair(t, a), b), c));
    } else {
      int a;
      cin >> a;
      Q.push_back(make_pair(make_pair(make_pair(t, a), 0), 0));
    }
  }
  for (int i = Q.size() - 1; i >= 0; i--) {
    int t = Q[i].first.first.first;
    if (t == 3) {
      int r = Q[i].first.first.second;
      int c = Q[i].first.second;
      A[r - 1][c - 1] = Q[i].second;
    } else if (t == 2) {
      int c = Q[i].first.first.second - 1;
      int temp = A[n - 1][c];
      for (int j = n - 1; j > 0; j--) A[j][c] = A[j - 1][c];
      A[0][c] = temp;
    } else {
      int r = Q[i].first.first.second - 1;
      int temp = A[r][m - 1];
      for (int j = m - 1; j > 0; j--) A[r][j] = A[r][j - 1];
      A[r][0] = temp;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << A[i][j] << " ";
    cout << endl;
  }
  return 0;
}
