#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
constexpr double pi = 3.14159265358979323846264338327950288419716939937511;
constexpr double eps = 1e-9;
char ch_ch_ch[1 << 20];
inline string gs() {
  scanf("%s", ch_ch_ch);
  return string(ch_ch_ch);
}
inline string gl() {
  gets(ch_ch_ch);
  return string(ch_ch_ch);
}
inline int gi() {
  int x;
  scanf("%d", &x);
  return x;
}
void solve() {
  int n = gi();
  int m = gi();
  int qn = gi();
  vector<vector<int>> a(n, vector<int>(m, 0));
  vector<vector<pair<int, int>>> link(n, vector<pair<int, int>>(m));
  for (auto i = (0); i < (n); ++i)
    for (auto j = (0); j < (m); ++j) link[i][j] = make_pair(i, j);
  for (auto i = (0); i < (qn); ++i) {
    int q = gi();
    if (q == 1) {
      int r = gi() - 1;
      pair<int, int> leftmost = link[r][0];
      for (auto j = (1); j < (m); ++j) link[r][j - 1] = link[r][j];
      link[r][m - 1] = leftmost;
    } else if (q == 2) {
      int c = gi() - 1;
      pair<int, int> topmost = link[0][c];
      for (auto j = (1); j < (n); ++j) link[j - 1][c] = link[j][c];
      link[n - 1][c] = topmost;
    } else {
      int r = gi() - 1;
      int c = gi() - 1;
      int v = gi();
      int x = link[r][c].first;
      int y = link[r][c].second;
      a[x][y] = v;
    }
  }
  for (auto i = (0); i < (n); ++i) {
    for (auto j = (0); j < (m); ++j) printf("%d ", a[i][j]);
    printf("\n");
  }
}
int main() {
  solve();
  return 0;
}
