#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
const long double eps = 1e-9;
const int INF = 1E9;
const int MAXN = 111;
int n, m, q;
pair<int, int> a[MAXN][MAXN];
int res[MAXN][MAXN];
int id, p, r, x;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(m); j++) a[i][j] = {i, j};
  for (int i = 0; i < (int)(q); i++) {
    scanf("%d", &id);
    if (id == 1) {
      scanf("%d", &p);
      p--;
      pair<int, int> tmp = a[p][0];
      for (int j = 0; j < m - 1; j++) a[p][j] = a[p][j + 1];
      a[p][m - 1] = tmp;
    } else if (id == 2) {
      scanf("%d", &p);
      p--;
      pair<int, int> tmp = a[0][p];
      for (int j = 0; j < n - 1; j++) a[j][p] = a[j + 1][p];
      a[n - 1][p] = tmp;
    } else {
      scanf("%d%d%d", &p, &r, &x);
      p--, r--;
      res[a[p][r].first][a[p][r].second] = x;
    }
  }
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(m); j++)
      printf("%d%c", res[i][j], " \n"[j == m - 1]);
  return 0;
}
