#include <bits/stdc++.h>
using namespace std;
int n, m, q, mp[110][110], r[10010], c[10010], x[10010], t[10010];
int main() {
  memset(mp, 0x3f3f3f3f, sizeof(mp));
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &t[i]);
    if (t[i] == 3)
      scanf("%d%d%d", &r[i], &c[i], &x[i]);
    else if (t[i] == 1)
      scanf("%d", &r[i]);
    else
      scanf("%d", &c[i]);
  }
  for (int i = q - 1; i >= 0; i--)
    if (t[i] == 3)
      mp[r[i]][c[i]] = x[i];
    else if (t[i] == 1) {
      for (int j = m + 1; j > 1; j--) mp[r[i]][j] = mp[r[i]][j - 1];
      mp[r[i]][1] = mp[r[i]][m + 1];
    } else {
      for (int j = n + 1; j > 1; j--) mp[j][c[i]] = mp[j - 1][c[i]];
      mp[1][c[i]] = mp[n + 1][c[i]];
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (mp[i][j] == 0x3f3f3f3f)
        printf("0 ");
      else
        printf("%d ", mp[i][j]);
    printf("\n");
  }
  return 0;
}
