#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int mat[maxn][maxn];
vector<int> vec[maxn * maxn];
int n, m, q;
int t, r, c, x;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  memset(mat, 0, sizeof(mat));
  for (int i = 0; i < q; ++i) {
    scanf("%d", &t);
    if (t == 1) {
      vec[i].push_back(t);
      scanf("%d", &r);
      vec[i].push_back(r);
    } else if (t == 2) {
      vec[i].push_back(t);
      scanf("%d", &c);
      vec[i].push_back(c);
    } else {
      vec[i].push_back(t);
      scanf("%d%d%d", &r, &c, &x);
      vec[i].push_back(r);
      vec[i].push_back(c);
      vec[i].push_back(x);
    }
  }
  for (int i = q - 1; i >= 0; --i) {
    if (vec[i][0] == 1) {
      mat[vec[i][1]][0] = mat[vec[i][1]][m];
      for (int j = m - 1; j >= 0; --j) {
        mat[vec[i][1]][j + 1] = mat[vec[i][1]][j];
      }
    } else if (vec[i][0] == 2) {
      mat[0][vec[i][1]] = mat[n][vec[i][1]];
      for (int j = n - 1; j >= 0; --j) {
        mat[j + 1][vec[i][1]] = mat[j][vec[i][1]];
      }
    } else {
      mat[vec[i][1]][vec[i][2]] = vec[i][3];
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < m; ++j) {
      printf("%d ", mat[i][j]);
    }
    printf("%d\n", mat[i][m]);
  }
  return 0;
}
