#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 5;
const int mod = 1e4 + 7;
int main() {
  int n, m, q, val[maxn][maxn] = {0}, op[mod][5];
  cin >> n >> m >> q;
  for (int i = 1; i <= q; i++) {
    cin >> op[i][0] >> op[i][1];
    if (op[i][0] == 3) cin >> op[i][2] >> op[i][3];
  }
  for (int i = q; i >= 1; i--) {
    if (op[i][0] == 1) {
      int x = op[i][1];
      int temp = val[x][m];
      for (int j = m - 1; j >= 1; j--) {
        val[x][j + 1] = val[x][j];
      }
      val[x][1] = temp;
    }
    if (op[i][0] == 2) {
      int y = op[i][1];
      int temp = val[n][y];
      for (int j = n - 1; j >= 1; j--) {
        val[j + 1][y] = val[j][y];
      }
      val[1][y] = temp;
    }
    if (op[i][0] == 3) {
      int x = op[i][1];
      int y = op[i][2];
      val[x][y] = op[i][3];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << val[i][j];
      if (j != m)
        cout << " ";
      else
        cout << endl;
    }
  }
  return 0;
}
