#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
namespace input {
inline int nextInt() {
  int res = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res;
}
inline long long nextLong() {
  long long res = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res;
}
inline bool isSpace(const char &c) {
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
inline void next(char *str) {
  char c = getchar();
  while (isSpace(c)) c = getchar();
  size_t head = 0;
  while (!isSpace(c)) str[head++] = c, c = getchar();
  str[head] = 0;
}
inline char nextChar() {
  char c = getchar();
  while (isSpace(c)) c = getchar();
  return c;
}
}  // namespace input
using namespace input;
const int N = 1e4 + 5;
int g[200][200];
int t[N], x[N], y[N], z[N];
void solve() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d %d", t + i, x + i);
    if (t[i] == 3) {
      scanf("%d %d", y + i, z + i);
    }
  }
  for (int i = 0; i < q; i++) {
    if (t[i] == 1) {
      int r = x[i];
      int l = g[r][1];
      for (int i = 1; i < m; i++) {
        g[r][i] = g[r][i + 1];
      }
      g[r][m] = l;
    } else if (t[i] == 2) {
      int c = x[i];
      int l = g[1][c];
      for (int i = 1; i < n; i++) {
        g[i][c] = g[i + 1][c];
      }
      g[n][c] = l;
    } else {
      int r = x[i];
      int c = y[i];
      int v = z[i];
      g[r][c] = v;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == 1) {
      int r = x[i];
      int l = g[r][m];
      for (int i = m; i > 1; i--) {
        g[r][i] = g[r][i - 1];
      }
      g[r][1] = l;
    } else if (t[i] == 2) {
      int c = x[i];
      int l = g[n][c];
      for (int i = n; i > 1; i--) {
        g[i][c] = g[i - 1][c];
      }
      g[1][c] = l;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      printf("%d ", g[i][j]);
    }
    puts("");
  }
}
