#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
int n, m, q;
long long ar[105][105], deff[105][105];
void REV(int x, int r) {
  if (x == 1) {
    long long temp = deff[r][1];
    for (int i = 1; i < m; i++) {
      deff[r][i] = deff[r][i + 1];
    }
    deff[r][m] = temp;
  } else {
    long long temp = deff[1][r];
    for (int i = 1; i < n; i++) {
      deff[i][r] = deff[i + 1][r];
    }
    deff[n][r] = temp;
  }
}
void PRINT() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ar[i][j] << " ";
    }
    cout << endl;
  }
}
void fefo(long long val, int place) {
  int c = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (c++ == place) {
        ar[i][j] = val;
        return;
      }
    }
}
int main() {
  cin >> n >> m >> q;
  int c = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) deff[i][j] = c++;
  vector<pair<pair<long long, long long>, pair<long long, long long> > > vec;
  while (q--) {
    long long fi;
    cin >> fi;
    if (fi == 1 || fi == 2) {
      long long ro;
      cin >> ro;
      vec.push_back({{fi, ro}, {0, 0}});
    } else {
      long long ri, ci;
      long long val;
      cin >> ri >> ci;
      cin >> val;
      vec.push_back({{fi, val}, {ri, ci}});
    }
  }
  for (int i = 0; i < vec.size(); ++i) {
    if (vec[i].first.first == 1 || vec[i].first.first == 2) {
      REV(vec[i].first.first, vec[i].first.second);
    } else {
      fefo(vec[i].first.second,
           deff[vec[i].second.first][vec[i].second.second]);
    }
  }
  PRINT();
  return 0;
}
