#include <bits/stdc++.h>
using namespace std;
const int UNDEF = 2000000000;
vector<vector<int>> matr;
int N, M;
void swipe_column(int col) {
  int val = matr[N - 1][col];
  for (int i = N - 1; i > 0; i--) {
    matr[i][col] = matr[i - 1][col];
  }
  matr[0][col] = val;
}
void swipe_row(int row) {
  int val = matr[row][M - 1];
  matr[row].pop_back();
  matr[row].insert(matr[row].begin(), val);
}
void print() {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cout << ((matr[i][j] == UNDEF) ? 0 : matr[i][j]) << " ";
    }
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> N >> M >> q;
  matr.resize(N, vector<int>(M, UNDEF));
  vector<vector<int>> req(q, vector<int>(4));
  for (int i = 0; i < q; i++) {
    cin >> req[i][0];
    cin >> req[i][1];
    if (req[i][0] == 3) {
      cin >> req[i][2];
      cin >> req[i][3];
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (req[i][0] == 1) {
      swipe_row(req[i][1] - 1);
    } else if (req[i][0] == 2) {
      swipe_column(req[i][1] - 1);
    } else {
      matr[req[i][1] - 1][req[i][2] - 1] = req[i][3];
    }
    cout << endl;
  }
  print();
  return 0;
}
