#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const int MAXN = 2e5 + 5, MAXC = 105;
const long long MOD = 1e9 + 7;
int vv[MAXC][MAXC];
int tt[MAXN], r[MAXN], c[MAXN], x[MAXN];
void solve() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = (0); i < (int)(q); i++) {
    scanf("%d", &tt[i]);
    if (tt[i] == 1) {
      scanf("%d", &r[i]);
    } else if (tt[i] == 2) {
      scanf("%d", &c[i]);
    } else {
      scanf("%d%d%d", &r[i], &c[i], &x[i]);
    }
  }
  for (int k = q - 1; k >= 0; k--) {
    if (tt[k] == 3) {
      vv[r[k]][c[k]] = x[k];
    } else if (tt[k] == 1) {
      for (int i = r[k]; i <= r[k]; i++) {
        for (int j = m + 1; j >= 2; j--) {
          vv[i][j] = vv[i][j - 1];
        }
        vv[i][1] = vv[i][m + 1];
      }
    } else if (tt[k] == 2) {
      for (int j = c[k]; j <= c[k]; j++) {
        for (int i = n + 1; i >= 2; i--) {
          vv[i][j] = vv[i - 1][j];
        }
        vv[1][j] = vv[n + 1][j];
      }
    }
  }
  for (int i = (1); i <= (int)(n); i++) {
    for (int j = (1); j <= (int)(m); j++) {
      printf("%d ", vv[i][j]);
    }
    putchar('\n');
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
