#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
int n, m, q;
int out[maxn][maxn];
int oper[10001][5];
int a, b, c, d;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = (1), _end_ = (q); i <= _end_; ++i) {
    cin >> oper[i][1];
    if (oper[i][1] == 1 || oper[i][1] == 2)
      cin >> oper[i][2];
    else
      for (int j = (2), _end_ = (4); j <= _end_; ++j) cin >> oper[i][j];
  }
  for (int i = (q), _end_ = (1); i >= _end_; --i) {
    if (oper[i][1] == 3) {
      out[oper[i][2]][oper[i][3]] = oper[i][4];
    } else if (oper[i][1] == 2) {
      for (int j = (n), _end_ = (1); j > _end_; --j)
        swap(out[j][oper[i][2]], out[j - 1][oper[i][2]]);
    } else {
      for (int j = (m), _end_ = (1); j > _end_; --j)
        swap(out[oper[i][2]][j], out[oper[i][2]][j - 1]);
    }
  }
  for (int i = (1), _end_ = (n); i <= _end_; ++i) {
    for (int j = (1), _end_ = (m); j <= _end_; ++j) cout << out[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
