#include <bits/stdc++.h>
using namespace std;
int orig[105][105];
struct entry {
  int val, rn, cn;
  entry() { val = 105, rn = 0, cn = 0; }
  entry(int x, int y) { val = 105, rn = x, cn = y; }
} st[105][105];
void row(int x, int m) {
  for (int i = 2; i <= m; i++) {
    swap(st[x][i], st[x][i - 1]);
  }
}
void col(int x, int n) {
  for (int i = 2; i <= n; i++) {
    swap(st[i][x], st[i - 1][x]);
  }
}
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      orig[i][j] = 105;
      st[i][j] = entry(i, j);
    }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      cin >> x;
      row(x, m);
    } else if (t == 2) {
      int x;
      cin >> x;
      col(x, n);
    } else {
      int a, b, c;
      cin >> a >> b >> c;
      orig[st[a][b].rn][st[a][b].cn] = c;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << orig[i][j] << ' ';
    }
    cout << "\n";
  }
}
