#include <bits/stdc++.h>
using namespace std;
struct node {
  long long no;
  long long l;
  long long r;
  long long val;
};
struct node viv[100000];
long long n, m, q, i, j, a[1001][1001], type[100000], arr[1001];
int main() {
  cin >> n;
  cin >> m;
  cin >> q;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = 0;
  for (i = 1; i <= q; i++) {
    cin >> type[i];
    if (type[i] == 1) {
      cin >> viv[i].no;
    }
    if (type[i] == 2) {
      cin >> viv[i].no;
    }
    if (type[i] == 3) {
      cin >> viv[i].l;
      cin >> viv[i].r;
      cin >> viv[i].val;
    }
  }
  for (i = q; i >= 1; i--) {
    if (type[i] == 1) {
      for (j = 1; j <= m; j++) arr[j] = a[viv[i].no][j];
      for (j = 2; j <= m; j++) {
        a[viv[i].no][j] = arr[j - 1];
      }
      a[viv[i].no][1] = arr[m];
    }
    if (type[i] == 2) {
      for (j = 1; j <= n; j++) arr[j] = a[j][viv[i].no];
      for (j = 2; j <= n; j++) {
        a[j][viv[i].no] = arr[j - 1];
      }
      a[1][viv[i].no] = arr[n];
    }
    if (type[i] == 3) {
      a[viv[i].l][viv[i].r] = viv[i].val;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << endl;
  }
}
