#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, q, val;
  cin >> n >> m >> q;
  map<pair<long long int, long long int>, pair<long long int, long long int>>
      shift;
  pair<long long int, long long int> temp;
  long long int matrix[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      temp.first = i;
      temp.second = j;
      shift[temp] = temp;
      matrix[i][j] = 0;
    }
  }
  pair<long long int, long long int> store, pair1, pair2;
  long long int type, row, col;
  while (q--) {
    cin >> type;
    if (type == 1) {
      cin >> row;
      row--;
      temp.first = row;
      temp.second = m - 1;
      pair2 = shift[temp];
      for (long long int i = 0; i < m; i++) {
        temp.first = row;
        temp.second = i;
        store.first = row;
        store.second = (i - 1 + m) % m;
        pair1 = shift[temp];
        shift[store] = pair1;
      }
      temp.first = row;
      temp.second = m - 2;
      shift[temp] = pair2;
    } else if (type == 2) {
      cin >> col;
      col--;
      temp.first = n - 1;
      temp.second = col;
      pair2 = shift[temp];
      for (long long int i = 0; i < n; i++) {
        temp.first = i;
        temp.second = col;
        store.first = (i - 1 + n) % n;
        store.second = col;
        pair1 = shift[temp];
        shift[store] = pair1;
      }
      temp.first = n - 2;
      temp.second = col;
      shift[temp] = pair2;
    } else {
      cin >> temp.first >> temp.second >> val;
      temp.first--;
      temp.second--;
      temp = shift[temp];
      matrix[temp.first][temp.second] = val;
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
