#include <bits/stdc++.h>
using namespace std;
int mg = 2000000000;
int a[103][103];
vector<pair<int, int> > qr;
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) a[i][j] = mg;
  while (q--) {
    int t, r, c, x;
    scanf("%d", &t);
    if (t == 3) {
      scanf("%d %d %d", &r, &c, &x);
      --r;
      --c;
      a[r][c] = x;
    } else if (t == 2) {
      scanf("%d", &c);
      --c;
      qr.push_back(make_pair(t, c));
      int temp = a[0][c];
      for (int i = 0; i < n - 1; ++i) a[i][c] = a[i + 1][c];
      a[n - 1][c] = temp;
    } else {
      scanf("%d", &r);
      --r;
      qr.push_back(make_pair(t, r));
      int temp = a[r][0];
      for (int i = 0; i < m - 1; ++i) a[r][i] = a[r][i + 1];
      a[r][m - 1] = temp;
    }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (a[i][j] == mg) a[i][j] = 0;
  reverse(qr.begin(), qr.end());
  for (int k = 0; k < (int)qr.size(); ++k) {
    int t = qr[k].first;
    int p = qr[k].second;
    if (t == 1) {
      int temp = a[p][m - 1];
      for (int i = m - 1; i > 0; --i) a[p][i] = a[p][i - 1];
      a[p][0] = temp;
    } else {
      int temp = a[n - 1][p];
      for (int i = n - 1; i > 0; --i) a[i][p] = a[i - 1][p];
      a[0][p] = temp;
    }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (j == m - 1)
        printf("%d\n", a[i][j]);
      else
        printf("%d ", a[i][j]);
    }
  return 0;
}
