#include <bits/stdc++.h>
using namespace std;
int t[10004];
long long a[102][102];
int r[10004], c[10004];
long long rr[10004], cc[10004], xx[10004];
int main() {
  int n, m;
  cin >> n >> m;
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> t[i];
    if (t[i] == 1) {
      cin >> r[i];
    } else if (t[i] == 2) {
      cin >> c[i];
    } else {
      cin >> rr[i] >> cc[i] >> xx[i];
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == 1) {
      long long d = a[r[i] - 1][m - 1];
      for (int k = m - 1; k >= 1; k--) {
        a[r[i] - 1][k] = a[r[i] - 1][k - 1];
      }
      a[r[i] - 1][0] = d;
    } else if (t[i] == 2) {
      long long d = a[n - 1][c[i] - 1];
      for (int k = n - 1; k >= 1; k--) {
        a[k][c[i] - 1] = a[k - 1][c[i] - 1];
      }
      a[0][c[i] - 1] = d;
    } else if (t[i] == 3) {
      a[rr[i] - 1][cc[i] - 1] = xx[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << a[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
