#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e2;
struct body {
  int number;
  int value;
};
body a[SIZE][SIZE];
int b[SIZE][SIZE];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int z = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++, z++) {
      a[i][j].number = z;
      b[i][j] = z;
    }
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int w;
      scanf("%d", &w);
      int tmp = b[--w][0];
      for (int g = m - 1; g >= 0; g--) {
        int x = b[w][g];
        b[w][g] = tmp;
        tmp = x;
      }
    }
    if (t == 2) {
      int w;
      scanf("%d", &w);
      int tmp = b[0][--w];
      for (int g = n - 1; g >= 0; g--) {
        int x = b[g][w];
        b[g][w] = tmp;
        tmp = x;
      }
    }
    if (t == 3) {
      int w, u, y;
      scanf("%d%d%d", &w, &u, &y);
      w--;
      u--;
      int k = b[w][u];
      bool L = 0;
      for (int i = 0; i < n && !L; i++)
        for (int j = 0; j < m && !L; j++)
          if (a[i][j].number == k) {
            a[i][j].value = y;
            L = 1;
            break;
          }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << a[i][j].value << " ";
    }
    cout << endl;
  }
  return 0;
}
