#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<long long int, long long int>,
            pair<long long int, long long int>>>
    V;
long long int N, M, cases;
long long int type;
long long int R, C, X;
long long int mat[105][105];
vector<pair<long long int, long long int>> rows, cols;
int main() {
  scanf("%lld %lld %lld", &N, &M, &cases);
  while (cases--) {
    scanf("%lld", &type);
    if (type == 1) {
      scanf("%lld", &R);
      V.push_back(make_pair(make_pair(1, R), make_pair(-1, -1)));
    } else if (type == 2) {
      scanf("%lld", &C);
      V.push_back(make_pair(make_pair(2, C), make_pair(-1, -1)));
    } else {
      scanf("%lld %lld %lld", &R, &C, &X);
      V.push_back(make_pair(make_pair(type, R), make_pair(C, X)));
    }
  }
  for (int i = V.size() - 1; i >= 0; i--) {
    if (V[i].first.first == 3) {
      mat[V[i].first.second][V[i].second.first] = V[i].second.second;
    } else if (V[i].first.first == 2) {
      cols.clear();
      for (int j = 1; j <= N; j++) {
        if (j == 1) {
          cols.push_back(
              make_pair(mat[j][V[i].first.second], mat[N][V[i].first.second]));
        } else {
          cols.push_back(make_pair(mat[j][V[i].first.second],
                                   mat[j - 1][V[i].first.second]));
        }
      }
      for (int j = 1; j <= N; j++) {
        mat[j][V[i].first.second] = cols[j - 1].second;
      }
    } else {
      rows.clear();
      for (int j = 1; j <= M; j++) {
        if (j == 1) {
          rows.push_back(
              make_pair(mat[V[i].first.second][j], mat[V[i].first.second][M]));
        } else {
          rows.push_back(make_pair(mat[V[i].first.second][j],
                                   mat[V[i].first.second][j - 1]));
        }
      }
      for (int j = 1; j <= M; j++) {
        mat[V[i].first.second][j] = rows[j - 1].second;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      cout << mat[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
