#include <bits/stdc++.h>
using namespace std;
int dir1[8][2] = {1, 2, 2, 1, 2, -1, 1, -2, -1, 2, -2, 1, -1, -2, -2, -1};
int dir2[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int dir3[8][2] = {1, 0, 0, 1, -1, 0, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
bool Isleap(int year) {
  if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) return true;
  return false;
}
bool isPrime(int x) {
  if (x == 1)
    return false;
  else if (x == 2)
    return true;
  for (int i = 2; i <= sqrt(x * 1.0); ++i) {
    if (x % i == 0) return false;
  }
  return true;
}
int sqr(int x) { return x * x; }
int num[120][120];
int choice[10005][4];
int main() {
  int n, m, q;
  while (~scanf("%d %d %d", &n, &m, &q)) {
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= q; ++i) {
      scanf("%d", &choice[i][0]);
      if (choice[i][0] <= 2)
        scanf("%d", &choice[i][1]);
      else
        scanf("%d %d %d", &choice[i][1], &choice[i][2], &choice[i][3]);
    }
    for (int i = q; i >= 1; --i) {
      if (choice[i][0] == 1) {
        int tmp = num[choice[i][1]][m];
        for (int j = m; j >= 2; --j)
          num[choice[i][1]][j] = num[choice[i][1]][j - 1];
        num[choice[i][1]][1] = tmp;
      }
      if (choice[i][0] == 2) {
        int tmp = num[n][choice[i][1]];
        for (int j = n; j >= 2; --j)
          num[j][choice[i][1]] = num[j - 1][choice[i][1]];
        num[1][choice[i][1]] = tmp;
      }
      if (choice[i][0] == 3) num[choice[i][1]][choice[i][2]] = choice[i][3];
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        if (j == m)
          printf("%d\n", num[i][j]);
        else
          printf("%d ", num[i][j]);
      }
    }
  }
  return 0;
}
