#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
  for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
    out << v[i] << " ";
  out << "\n";
  return out;
}
template <typename T, typename N>
std::ostream &operator<<(std::ostream &out, vector<pair<T, N> > &v) {
  for (size_t i = 0; i < v.size(); ++i)
    out << "(" << v[i].first << ", " << v[i].second << ") ";
  out << "\n";
  return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<vector<T> > &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    for (size_t j = 0; j < v[i].size(); ++j) {
      out << v[i][j] << " ";
    }
    out << "\n";
  }
  return out;
}
void shift_down(vector<vector<int> > &mat, int n, int c) {
  int elem = mat[n - 1][c];
  for (int i = n - 2; i >= 0; --i) {
    mat[i + 1][c] = mat[i][c];
  }
  mat[0][c] = elem;
}
void shift_right(vector<vector<int> > &mat, int m, int r) {
  int elem = mat[r][m - 1];
  for (int i = m - 2; i >= 0; --i) {
    mat[r][i + 1] = mat[r][i];
  }
  mat[r][0] = elem;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<int> t(q, -1), r(q, -1), c(q, -1), x(q, -1);
  int o, j, k, l;
  for (int i = 0; i < q; ++i) {
    cin >> o;
    if (o == 1) {
      t[i] = 1;
      cin >> r[i];
    } else if (o == 2) {
      t[i] = 2;
      cin >> c[i];
    } else {
      t[i] = 3;
      cin >> r[i] >> c[i] >> x[i];
    }
  }
  vector<vector<int> > mat(n, vector<int>(m));
  for (int i = q - 1; i >= 0; --i) {
    if (t[i] == 1) {
      shift_right(mat, m, r[i] - 1);
    } else if (t[i] == 2) {
      shift_down(mat, n, c[i] - 1);
    } else {
      mat[r[i] - 1][c[i] - 1] = x[i];
    }
  }
  cout << mat;
  return 0;
}
