#include <bits/stdc++.h>
using namespace std;
const int N = 10005, M = 105;
int n, m, q, cur_r, cur_c, t[N], r[N], c[N], val[N], pr[M][M];
int main() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &t[i]);
    if (t[i] == 1) {
      scanf("%d", &r[i]);
      r[i]--;
    } else if (t[i] == 2) {
      scanf("%d", &c[i]);
      c[i]--;
    } else {
      scanf("%d %d %d", &r[i], &c[i], &val[i]);
      cur_r = r[i] - 1, cur_c = c[i] - 1;
      for (int j = i - 1; j >= 0; j--) {
        if (t[j] == 1 && r[j] == cur_r) {
          if (cur_c == m - 1)
            cur_c = 0;
          else
            cur_c++;
        }
        if (t[j] == 2 && c[j] == cur_c) {
          if (cur_r == n - 1)
            cur_r = 0;
          else
            cur_r++;
        }
      }
      pr[cur_r][cur_c] = val[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%d ", pr[i][j]);
    printf("\n");
  }
  return 0;
}
