#include <bits/stdc++.h>
using namespace std;
class A {
 public:
  int a;
  int b;
  int c;
  int d;
} aa[100005];
int a[103][103];
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  int i;
  for (i = 0; i < q; i++) {
    cin >> aa[i].a >> aa[i].b;
    if (aa[i].a == 1 || aa[i].a == 2) {
      aa[i].c = 0;
      aa[i].d = 0;
    } else {
      cin >> aa[i].c;
      cin >> aa[i].d;
    }
  }
  int j;
  for (j = q - 1; j >= 0; j--) {
    int x = aa[j].a;
    int y = aa[j].b;
    int z = aa[j].c;
    int w = aa[j].d;
    if (x == 1) {
      int g = a[y][m];
      for (i = m; i >= 2; i--) {
        a[y][i] = a[y][i - 1];
      }
      a[y][1] = g;
    } else if (x == 2) {
      int g = a[n][y];
      for (i = n; i >= 2; i--) {
        a[i][y] = a[i - 1][y];
      }
      a[1][y] = g;
    } else {
      a[y][z] = w;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
}
