#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
void cycleRow(int** arr, int row, int size) {
  int temp = arr[row][size - 1];
  for (int i = 1; i < (size); i++) {
    arr[row][size - i] = arr[row][size - i - 1];
  }
  arr[row][0] = temp;
}
void cycleColomn(int** arr, int colomn, int size) {
  int temp = arr[size - 1][colomn];
  for (int i = 1; i < (size); i++) {
    arr[size - i][colomn] = arr[size - i - 1][colomn];
  }
  arr[0][colomn] = temp;
}
void solve() {
  int N;
  cin >> N;
  int M;
  cin >> M;
  int q;
  cin >> q;
  int** a;
  int op[q][4];
  for (int i = 0; i < (q); i++) {
    for (int j = 0; j < (4); j++) op[i][j] = 0;
  }
  a = new int*[N];
  for (int i = 0; i < (N); i++) a[i] = new int[M];
  for (int i = 0; i < (N); i++)
    for (int j = 0; j < (M); j++) a[i][j] = 0;
  for (int i = 0; i < (q); i++) {
    cin >> op[i][0];
    switch (op[i][0]) {
      case 1:
        cin >> op[i][1];
        break;
      case 2:
        cin >> op[i][1];
        break;
      default:
        cin >> op[i][1];
        cin >> op[i][2];
        cin >> op[i][3];
        break;
    }
  }
  for (int i = (q)-1; i >= 0; i--) {
    int type = op[i][0];
    switch (type) {
      case 1:
        cycleRow(a, op[i][1] - 1, M);
        break;
      case 2:
        cycleColomn(a, op[i][1] - 1, N);
        break;
      default:
        int r = op[i][1];
        int c = op[i][2];
        int x = op[i][3];
        a[r - 1][c - 1] = x;
        break;
    }
  }
  for (int i = 0; i < (N); i++) {
    cout << a[i][0];
    for (int j = 1; j < (M); j++) {
      cout << " ";
      cout << a[i][j];
    }
    cout << "" << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
