#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const int MOD = 1e9 + 7;
const long double EPS = 1e-9;
int mat[100][100];
int n, m;
void move_row(int k) {
  int sv = mat[k][0];
  for (int i = 1; i < m; i++) {
    mat[k][i - 1] = mat[k][i];
  }
  mat[k][m - 1] = sv;
}
void move_col(int l) {
  int sv = mat[0][l];
  for (int i = 1; i < n; i++) {
    mat[i - 1][l] = mat[i][l];
  }
  mat[n - 1][l] = sv;
}
void move_row_r(int k) {
  int sv = mat[k][m - 1];
  for (int i = m - 2; i >= 0; i--) {
    mat[k][i + 1] = mat[k][i];
  }
  mat[k][0] = sv;
}
void move_col_r(int l) {
  int sv = mat[n - 1][l];
  for (int i = n - 2; i >= 0; i--) {
    mat[i + 1][l] = mat[i][l];
  }
  mat[0][l] = sv;
}
int main() {
  ios_base::sync_with_stdio(false);
  vector<pair<int, int> > rq;
  cin >> n >> m;
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 3) {
      int r, c;
      cin >> r >> c;
      cin >> mat[r - 1][c - 1];
    } else {
      int nm;
      cin >> nm;
      nm--;
      rq.push_back({t, nm});
      if (t == 1) {
        move_row(nm);
      } else {
        move_col(nm);
      }
    }
  }
  reverse(rq.begin(), rq.end());
  for (auto x : rq) {
    if (x.first == 1) {
      move_row_r(x.second);
    } else {
      move_col_r(x.second);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << mat[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
