#include <bits/stdc++.h>
using namespace std;
int matrix[101][101];
struct HATE {
  int t, r, c, x;
  HATE(int t, int r, int c, int x) {
    this->t = t;
    this->r = r;
    this->c = c;
    this->x = x;
  }
};
HATE* hates[10001];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      matrix[i][j] = 1e9 + 1;
    }
  }
  for (int heh = 0; heh < q; heh++) {
    int t;
    cin >> t;
    if (t == 1) {
      int r;
      cin >> r;
      hates[heh] = new HATE(t, r, 0, 0);
    } else if (t == 2) {
      int c;
      cin >> c;
      hates[heh] = new HATE(t, 0, c, 0);
    } else {
      int r, c, x;
      cin >> r >> c >> x;
      hates[heh] = new HATE(t, r, c, x);
    }
  }
  for (int heh = q - 1; heh >= 0; heh--) {
    int t = hates[heh]->t;
    int r = hates[heh]->r;
    int c = hates[heh]->c;
    int x = hates[heh]->x;
    if (t == 1) {
      r--;
      int temp = matrix[r][m - 1];
      for (int i = m - 1; i >= 1; i--) {
        matrix[r][i] = matrix[r][i - 1];
      }
      matrix[r][0] = temp;
    } else if (t == 2) {
      c--;
      int temp = matrix[n - 1][c];
      for (int i = n - 1; i >= 1; i--) {
        matrix[i][c] = matrix[i - 1][c];
      }
      matrix[0][c] = temp;
    } else {
      r--;
      c--;
      matrix[r][c] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (matrix[i][j] == 1e9 + 1) {
        cout << 1488 << ' ';
      } else {
        cout << matrix[i][j] << ' ';
      }
    }
    cout << endl;
  }
}
