#include <bits/stdc++.h>
using namespace std;
struct Query {
  int i, j, x, t;
  void scan() {
    cin >> t;
    if (t == 3) {
      cin >> i >> j >> x;
    } else if (t == 1) {
      cin >> i;
    } else if (t == 2) {
      cin >> j;
    }
    --i;
    --j;
  }
};
const int MAX_Q = 10050;
Query queries[MAX_Q];
int n, m, q;
const int MAX_N = 105;
int matr[MAX_N][MAX_N];
void shifti(int i) {
  int lasttmp = matr[i][m - 1];
  for (int j = m - 1; j >= 1; --j) {
    matr[i][j] = matr[i][j - 1];
  }
  matr[i][0] = lasttmp;
}
void shiftj(int j) {
  int lasttmp = matr[n - 1][j];
  for (int i = n - 1; i >= 1; --i) {
    matr[i][j] = matr[i - 1][j];
  }
  matr[0][j] = lasttmp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int k = 0; k < q; ++k) {
    queries[k].scan();
  }
  for (int k = q - 1; k >= 0; --k) {
    if (queries[k].t == 3) {
      matr[queries[k].i][queries[k].j] = queries[k].x;
    } else if (queries[k].t == 2) {
      shiftj(queries[k].j);
    } else if (queries[k].t == 1) {
      shifti(queries[k].i);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << matr[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
