#include <bits/stdc++.h>
using namespace std;
int r[10007], c[10007], x[10007], t[10007];
int a[107][107], b[107][107];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < q; ++i) {
    cin >> t[i];
    if (t[i] < 3)
      cin >> r[i];
    else
      cin >> r[i] >> c[i] >> x[i];
  }
  int last;
  for (int i = 0; i < q; ++i) {
    --r[i];
    --c[i];
    if (t[i] == 1) {
      last = a[r[i]][0];
      for (int j = 0; j < m - 1; ++j) a[r[i]][j] = a[r[i]][j + 1];
      a[r[i]][m - 1] = last;
    } else if (t[i] == 2) {
      last = a[0][r[i]];
      for (int j = 0; j < n - 1; ++j) a[j][r[i]] = a[j + 1][r[i]];
      a[n - 1][r[i]] = last;
    } else
      a[r[i]][c[i]] = x[i];
  }
  for (int i = q - 1; i > -1; --i) {
    if (t[i] == 1) {
      last = a[r[i]][m - 1];
      for (int j = m - 2; j > -1; --j) a[r[i]][j + 1] = a[r[i]][j];
      a[r[i]][0] = last;
    } else if (t[i] == 2) {
      last = a[n - 1][r[i]];
      for (int j = n - 2; j > -1; --j) a[j + 1][r[i]] = a[j][r[i]];
      a[0][r[i]] = last;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cout << a[i][j] << ' ';
    cout << "\n";
  }
  return 0;
}
