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