#include <bits/stdc++.h>
using namespace std;
int n, m;
int data[100][100];
int action[10000], value[10000];
void rowleftshift(int r) {
  int temp = data[r][0];
  for (int j = 0; j < m - 1; j++) data[r][j] = data[r][j + 1];
  data[r][m - 1] = temp;
}
void rowrightshift(int r) {
  int temp = data[r][m - 1];
  for (int j = m - 1; j >= 1; j--) data[r][j] = data[r][j - 1];
  data[r][0] = temp;
}
void colupshift(int c) {
  int temp = data[0][c];
  for (int i = 0; i < n - 1; i++) data[i][c] = data[i + 1][c];
  data[n - 1][c] = temp;
}
void coldownshift(int c) {
  int temp = data[n - 1][c];
  for (int i = n - 1; i >= 1; i--) data[i][c] = data[i - 1][c];
  data[0][c] = temp;
}
void print() {
  for (int i = 0; i < n; i++, cout << "\n")
    for (int j = 0; j < m; j++, cout << " ") cout << data[i][j];
  system("pause");
}
int main() {
  int q, curr;
  cin >> n >> m >> q;
  for (int t = 0; t < q; t++) {
    cin >> curr;
    if (curr == 1 || curr == 2) {
      action[t] = curr;
      cin >> value[t];
      value[t]--;
      if (curr == 1)
        rowleftshift(value[t]);
      else
        colupshift(value[t]);
    } else {
      int i, j;
      cin >> i >> j;
      i--;
      j--;
      cin >> data[i][j];
    }
  }
  for (int t = q; t >= 0; t--) {
    if (action[t] == 1)
      rowrightshift(value[t]);
    else if (action[t] == 2)
      coldownshift(value[t]);
  }
  for (int i = 0; i < n; i++, cout << "\n")
    for (int j = 0; j < m; j++, cout << " ") cout << data[i][j];
  return 0;
}
