#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0), eps = 1e-6;
void File() {
  freopen("D:\\in.txt", "r", stdin);
  freopen("D:\\out.txt", "w", stdout);
}
template <class T>
inline void read(T &x) {
  char c = getchar();
  x = 0;
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
}
const int maxn = 110;
int n, m, q;
int ans[maxn][maxn];
int op[10010], r[10010], c[10010], v[10010];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &op[i]);
    if (op[i] == 1)
      scanf("%d", &r[i]);
    else if (op[i] == 2)
      scanf("%d", &c[i]);
    else
      scanf("%d%d%d", &r[i], &c[i], &v[i]);
  }
  for (int i = q; i >= 1; i--) {
    if (op[i] == 3)
      ans[r[i]][c[i]] = v[i];
    else if (op[i] == 1) {
      for (int j = m; j > 1; j--) swap(ans[r[i]][j], ans[r[i]][j - 1]);
    } else {
      for (int j = n; j > 1; j--) swap(ans[j][c[i]], ans[j - 1][c[i]]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
