#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 10;
int arr[MAXN][MAXN];
int arr2[MAXN][MAXN], ans[MAXN][MAXN];
int qq[MAXN * MAXN][4];
int n, m, q;
void Shftr(int a) {
  int k = arr[a][m - 1];
  for (int i = m - 1; i > 0; i--) arr[a][i] = arr[a][i - 1];
  arr[a][0] = k;
}
void Shftc(int a) {
  int k = arr[n - 1][a];
  for (int i = n - 1; i > 0; i--) arr[i][a] = arr[i - 1][a];
  arr[0][a] = k;
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    cin >> qq[i][0];
    if (qq[i][0] != 3)
      cin >> qq[i][1];
    else
      cin >> qq[i][1] >> qq[i][2] >> qq[i][3];
  }
  for (int i = q - 1; i >= 0; i--) {
    int t, a, b, c;
    t = qq[i][0];
    a = qq[i][1];
    b = qq[i][2];
    c = qq[i][3];
    a--;
    b--;
    if (t == 1)
      Shftr(a);
    else if (t == 2)
      Shftc(a);
    else
      arr[a][b] = c;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << arr[i][j] << " ";
    cout << endl;
  }
}
