#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<pair<int, int> > > st(n, vector<pair<int, int> >(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      st[i][j] = {i, j};
    }
  }
  vector<vector<int> > a(n, vector<int>(m));
  while (q-- > 0) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      --r;
      for (int i = 1; i < m; ++i) {
        swap(st[r][i], st[r][i - 1]);
      }
    } else if (t == 2) {
      int c;
      cin >> c;
      --c;
      for (int i = 1; i < n; ++i) {
        swap(st[i][c], st[i - 1][c]);
      }
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      --r, --c;
      a[st[r][c].first][st[r][c].second] = x;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << a[i][j] << ' ';
    }
    cout << endl;
  }
}
