#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n, m, q;
  cin >> n >> m >> q;
  int mat[100][100], org[100][100];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      mat[i][j] = i * m + j;
      org[i][j] = INT_MAX;
    }
  }
  for (int i = 0; i < q; i++) {
    int t, r, c, x;
    cin >> t;
    switch (t) {
      case 1:
        cin >> r;
        r--;
        x = mat[r][0];
        for (int i = 0; i < m - 1; i++) mat[r][i] = mat[r][i + 1];
        mat[r][m - 1] = x;
        break;
      case 2:
        cin >> c;
        c--;
        x = mat[0][c];
        for (int i = 0; i < n - 1; i++) mat[i][c] = mat[i + 1][c];
        mat[n - 1][c] = x;
        break;
      case 3:
        cin >> r >> c >> x;
        int a = mat[r - 1][c - 1];
        org[a / m][a % m] = x;
        break;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << (org[i][j] == INT_MAX ? 0 : org[i][j]);
      cout << (j == m - 1 ? '\n' : ' ');
    }
  }
  return 0;
}
