#include <bits/stdc++.h>
using namespace std;
void shift_row_left(long long a[][102], long long r, long long c) {
  long long temp = a[r][1];
  for (int i = 2; i <= c; i++) {
    a[r][i - 1] = a[r][i];
  }
  a[r][c] = temp;
}
void shift_row_right(long long a[][102], long long r, long long c) {
  long long temp = a[r][c];
  for (int i = c; i >= 2; i--) {
    a[r][i] = a[r][i - 1];
  }
  a[r][1] = temp;
}
void shift_col_up(long long a[][102], long long r, long long c) {
  long long temp = a[1][c];
  for (int i = 2; i <= r; i++) {
    a[i - 1][c] = a[i][c];
  }
  a[r][c] = temp;
}
void shift_col_down(long long a[][102], long long r, long long c) {
  long long temp = a[r][c];
  for (int i = r; i >= 2; i--) {
    a[i][c] = a[i - 1][c];
  }
  a[1][c] = temp;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, a[102][102], q, b[2][10004];
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) a[i][j] = 0;
  }
  for (int i = 0; i < q; i++) {
    long long t, r, c, x;
    cin >> t;
    switch (t) {
      case 1:
        cin >> r;
        shift_row_left(a, r, m);
        b[0][i] = 1;
        b[1][i] = r;
        break;
      case 2:
        cin >> c;
        shift_col_up(a, n, c);
        b[0][i] = 2;
        b[1][i] = c;
        break;
      case 3:
        cin >> r >> c >> x;
        a[r][c] = x;
        b[0][i] = 3;
        break;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    switch (b[0][i]) {
      case 1:
        shift_row_right(a, b[1][i], m);
        break;
      case 2:
        shift_col_down(a, n, b[1][i]);
        break;
      case 3:
        break;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
