#include <bits/stdc++.h>
using namespace std;
const int MAXN = 150005;
const int MAXM = 1000005;
const int MOD = 1000000007;
const int MAMOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double EPS = 1e-8;
int n, m, q;
struct que {
  int op, r, c, x;
} Q[MAXN];
int ans[105][105];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= q; ++i) {
    cin >> Q[i].op;
    if (Q[i].op == 1)
      cin >> Q[i].r;
    else if (Q[i].op == 2)
      cin >> Q[i].c;
    else
      cin >> Q[i].r >> Q[i].c >> Q[i].x;
  }
  for (int i = q; i >= 1; --i) {
    if (Q[i].op == 1) {
      ans[Q[i].r][0] = ans[Q[i].r][m];
      for (int j = m; j >= 1; --j) ans[Q[i].r][j] = ans[Q[i].r][j - 1];
    } else if (Q[i].op == 2) {
      ans[0][Q[i].c] = ans[n][Q[i].c];
      for (int j = n; j >= 1; --j) ans[j][Q[i].c] = ans[j - 1][Q[i].c];
    } else
      ans[Q[i].r][Q[i].c] = Q[i].x;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cout << ans[i][j] << (j == m ? "\n" : " ");
  return 0;
}
