#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  long long n, m, t;
  cin >> n >> m >> t;
  vector<vector<long long>> a(n, vector<long long>(m));
  long long q[10000][4];
  for (long long i = 0; i < (long long)t; i++) {
    cin >> q[i][0];
    if (q[i][0] == 3) {
      for (long long j = 1; j < (long long)4; j++) cin >> q[i][j];
    } else
      cin >> q[i][1];
  }
  for (long long i = t - 1; i >= 0; i--) {
    if (q[i][0] == 3)
      a[q[i][1] - 1][q[i][2] - 1] = q[i][3];
    else if (q[i][0] == 2) {
      long long qy = a[n - 1][q[i][1] - 1];
      for (long long j = n - 1; j > 0; j--) {
        a[j][q[i][1] - 1] = a[j - 1][q[i][1] - 1];
      }
      a[0][q[i][1] - 1] = qy;
    } else if (q[i][0] == 1) {
      long long qy = a[q[i][1] - 1][m - 1];
      for (long long j = m - 1; j > 0; j--) {
        a[q[i][1] - 1][j] = a[q[i][1] - 1][j - 1];
      }
      a[q[i][1] - 1][0] = qy;
    }
  }
  for (long long i = 0; i < (long long)n; i++) {
    for (long long qz = 0; qz < (long long)a[i].size(); qz++)
      cout << (a[i])[qz] << ' ';
    cout << "\n";
  }
  return 0;
}
