#include <bits/stdc++.h>
using namespace std;
const int me = 100005;
const int mod = 1.e9 + 7;
struct query {
  int type;
  int rc;
  int xy;
  int value;
  query() {}
};
int n, m, qq;
query q[me];
int mat[105][105];
int main() {
  scanf("%d%d%d", &n, &m, &qq);
  for (int i = 0; i < qq; i++) {
    scanf("%d", &q[i].type);
    if (q[i].type == 1) {
      scanf("%d", &q[i].rc);
    } else if (q[i].type == 2)
      scanf("%d", &q[i].rc);
    else {
      scanf("%d%d%d", &q[i].rc, &q[i].xy, &q[i].value);
    }
  }
  for (int i = qq - 1; i >= 0; i--) {
    if (q[i].type == 3) {
      mat[q[i].rc][q[i].xy] = q[i].value;
    } else if (q[i].type == 1) {
      int w = mat[q[i].rc][m];
      for (int j = m - 1; j > 0; j--) mat[q[i].rc][j + 1] = mat[q[i].rc][j];
      mat[q[i].rc][1] = w;
    } else {
      int w = mat[n][q[i].rc];
      for (int j = n - 1; j > 0; j--) mat[j + 1][q[i].rc] = mat[j][q[i].rc];
      mat[1][q[i].rc] = w;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << mat[i][j] << " ";
    cout << endl;
  }
  return 0;
}
