#include <bits/stdc++.h>
using namespace std;
template <class T>
void print_2darray(const char* second, T arr, int n, int m) {
  cout << "> " << second << endl;
  cout << "[" << endl;
  for (int i = 0; i < n; i++) {
    cout << "{";
    for (int j = 0; j < m; j++) {
      cout << arr[i][j] << (j == m - 1 ? "" : ",");
    }
    cout << "}" << endl;
  }
  cout << "]" << endl;
}
template <class T>
void print_1darray(const char* second, T arr, int n) {
  cout << "> " << second << endl;
  cout << "[" << endl;
  for (int i = 0; i < n; i++) {
    cout << arr[i] << (i == n - 1 ? "" : ",");
  }
  cout << endl << "]" << endl;
}
const int N = 100, M = 100, Q = 10000;
int n, m, q;
int ans[N + 1][M + 1];
int q1[Q];
int q2[Q];
int q3[Q];
int q4[Q];
void shift_col(int c) {
  int x = ans[n][c];
  for (int i = n - 1; i >= 1; i--) {
    ans[i + 1][c] = ans[i][c];
  }
  ans[1][c] = x;
}
void shift_row(int r) {
  int x = ans[r][m];
  for (int i = m - 1; i >= 1; i--) {
    ans[r][i + 1] = ans[r][i];
  }
  ans[r][1] = x;
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> q1[i];
    if (q1[i] != 3) {
      cin >> q2[i];
    } else {
      cin >> q2[i] >> q3[i] >> q4[i];
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (q1[i] == 1) {
      shift_row(q2[i]);
    } else if (q1[i] == 2) {
      shift_col(q2[i]);
    } else {
      ans[q2[i]][q3[i]] = q4[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
