#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int matrix[100][100];
int ans[10000];
void fill() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      matrix[i][j] = i * m + j;
    }
  }
}
void solve_1(int i) {
  int temp;
  temp = matrix[i][m - 1];
  matrix[i][m - 1] = matrix[i][0];
  for (int j = m - 2; j >= 0; --j) {
    int new_temp = matrix[i][j];
    matrix[i][j] = temp;
    temp = new_temp;
  }
}
void solve_2(int j) {
  int temp;
  temp = matrix[n - 1][j];
  matrix[n - 1][j] = matrix[0][j];
  for (int i = n - 2; i >= 0; --i) {
    int new_temp = matrix[i][j];
    matrix[i][j] = temp;
    temp = new_temp;
  }
}
int main(int argc, char *argv[]) {
  memset(ans, 0, sizeof(ans));
  scanf("%d%d%d", &n, &m, &q);
  fill();
  while (q--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int n_i;
      scanf("%d", &n_i);
      n_i--;
      solve_1(n_i);
    } else if (t == 2) {
      int m_i;
      scanf("%d", &m_i);
      m_i--;
      solve_2(m_i);
    } else {
      int r, c, x;
      scanf("%d%d%d", &r, &c, &x);
      r--;
      c--;
      ans[matrix[r][c]] = x;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      printf("%d ", ans[i * m + j]);
    }
    puts("");
  }
  return 0;
}
