#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, q;
  cin >> n >> m >> q;
  long long int dda[n + 1][m + 1];
  for (long long int i = 1; i <= n; i += 1) {
    for (long long int j = 1; j <= m; j += 1) {
      dda[i][j] = 0;
    }
  }
  vector<long long int> v[q];
  for (long long int i = 0; i < q; i += 1) {
    long long int t;
    cin >> t;
    v[i].push_back(t);
    if (t == 3) {
      long long int r, c, x;
      cin >> r >> c >> x;
      v[i].push_back(r);
      v[i].push_back(c);
      v[i].push_back(x);
    } else {
      long long int x;
      cin >> x;
      v[i].push_back(x);
    }
  }
  for (long long int i = q - 1; i >= 0; i -= 1) {
    if (v[i][0] == 3) {
      long long int r = v[i][1];
      long long int c = v[i][2];
      long long int x = v[i][3];
      dda[r][c] = x;
    } else {
      if (v[i][0] == 2) {
        long long int c = v[i][1];
        long long int temp = dda[n][c];
        for (long long int j = n; j > 1; j -= 1) {
          dda[j][c] = dda[j - 1][c];
        }
        dda[1][c] = temp;
      } else {
        long long int r = v[i][1];
        long long int temp = dda[r][m];
        for (long long int j = m; j > 1; j -= 1) {
          dda[r][j] = dda[r][j - 1];
        }
        dda[r][1] = temp;
      }
    }
  }
  for (long long int i = 1; i <= n; i += 1) {
    for (long long int j = 1; j <= m; j += 1) {
      cout << dda[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
