#include <bits/stdc++.h>
using namespace std;
const int maxN = 100009;
vector<int> wek[maxN];
int x, n, c, m, q;
string s;
int tab[109][109];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    vector<int> tmp;
    tmp.resize(0);
    scanf("%d", &x);
    tmp.push_back(x);
    scanf("%d", &c);
    tmp.push_back(c);
    if (x == 3) {
      scanf("%d", &x);
      tmp.push_back(x);
      scanf("%d", &x);
      tmp.push_back(x);
    }
    wek[i] = tmp;
  }
  for (int i = q - 1; i >= 0; i--) {
    vector<int> tmp = wek[i];
    if (tmp[0] == 3) {
      tab[tmp[1]][tmp[2]] = tmp[3];
    }
    if (tmp[0] == 2) {
      int column = tmp[1];
      int colFirst = tab[n][column];
      for (int i = n; i > 0; i--) {
        tab[i][column] = tab[i - 1][column];
      }
      tab[1][column] = colFirst;
    }
    if (tmp[0] == 1) {
      int row = tmp[1];
      int colFirst = tab[row][m];
      for (int i = m; i > 0; i--) {
        tab[row][i] = tab[row][i - 1];
      }
      tab[row][1] = colFirst;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%d ", tab[i][j]);
    printf("\n");
  }
  return 0;
}
