#include <bits/stdc++.h>
using namespace std;
int A[105][105];
struct data {
  int first;
  int second;
  int third;
};
data B[10005];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= q; ++i) {
    int t;
    scanf("%d", &t);
    if (t != 3) {
      int p;
      scanf("%d", &p);
      B[i].first = t;
      B[i].second = p;
      B[i].third = -1000000007;
    } else {
      scanf("%d %d %d", &B[i].first, &B[i].second, &B[i].third);
    }
  }
  for (int i = q; i > 0; --i) {
    if (B[i].third == -1000000007) {
      if (B[i].first == 1) {
        int t = A[B[i].second][1];
        for (int j = 2; j <= m; ++j) {
          int temp = A[B[i].second][j];
          A[B[i].second][j] = t;
          t = temp;
        }
        A[B[i].second][1] = t;
      } else {
        int t = A[1][B[i].second];
        for (int j = 2; j <= n; ++j) {
          int temp = A[j][B[i].second];
          A[j][B[i].second] = t;
          t = temp;
        }
        A[1][B[i].second] = t;
      }
    } else {
      A[B[i].first][B[i].second] = B[i].third;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      printf("%d ", A[i][j]);
    }
    cout << endl;
  }
  return 0;
}
