#include <bits/stdc++.h>
using namespace std;
long long POWER(long long a, long long p) {
  if (p == 0) return 1;
  long long b = a;
  for (int i = 1; i < p; i++) {
    b *= a;
  }
  return b;
}
long long GCD(long long a, long long b) {
  if (b) return GCD(b, a % b);
  return a;
}
long long LCM(long long F, long long G) {
  long long A = min(F, G), B = max(F, G), i = 1;
  while ((B * i) % A) i++;
  return B * i;
}
int main() {
  long long n, m, q, a[10005] = {0}, b[10005] = {0}, c[10005] = {0},
                     d[10005] = {0};
  cin >> n >> m >> q;
  long long ans[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) ans[i][j] = 0;
  }
  for (int i = 0; i < q; i++) {
    cin >> a[i];
    if (a[i] == 1 || a[i] == 2)
      cin >> b[i];
    else {
      long long l, r, x;
      cin >> l >> r >> x;
      for (int j = i - 1; j >= 0; j--) {
        if (a[j] == 1 && b[j] == l) {
          r++;
          if (r > m) {
            r = 1;
          }
        } else if (a[j] == 2 && b[j] == r) {
          l++;
          if (l > n) {
            l = 1;
          }
        }
      }
      l--;
      r--;
      ans[l][r] = x;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
