#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline T gcd(T a, T b) {
  return __gcd(a, b);
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long temp) {
  long long res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
long long ison(long long mask, long long pos) { return (mask & (1 << pos)); }
long long cbit(long long n) {
  long long k = 0;
  while (n) n &= (n - 1), k++;
  return k;
}
long long nbit(long long n) {
  long long k = 0;
  while (n) n /= 2, k++;
  return k;
}
long long mod = 1e9 + 7;
int sgn(long long x) { return x < 0 ? -1 : !!x; }
long long xo(long long i) {
  if ((i & 3) == 0) return i;
  if ((i & 3) == 1) return 1;
  if ((i & 3) == 2) return i + 1;
  return 0;
}
pair<long long, long long> a[105][105];
long long ans[105][105];
int main() {
  long long t, q, i, j, k, l, m, n;
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = make_pair(i, j);
  while (q--) {
    cin >> t;
    if (t == 1) {
      cin >> l;
      pair<long long, long long> temp[105];
      temp[m] = a[l][1];
      for (j = 1; j < m; j++) temp[j] = a[l][j + 1];
      for (j = 1; j <= m; j++) a[l][j] = temp[j];
    }
    if (t == 2) {
      cin >> l;
      pair<long long, long long> temp[105];
      temp[n] = a[1][l];
      for (j = 1; j < n; j++) temp[j] = a[j + 1][l];
      for (j = 1; j <= n; j++) a[j][l] = temp[j];
    }
    if (t == 3) {
      long long l, r, x;
      cin >> l >> r >> x;
      ans[a[l][r].first][a[l][r].second] = x;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }
}
