#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653;
const long long MOD = 1000000007;
const long long mod = 998244353;
const string no = "NO\n", yes = "YES\n";
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, q, t, r, clear, v, i, j;
  cin >> n >> m >> q;
  pair<int, int> p[n][m];
  long long val[n + 1][m + 1];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      p[i][j] = make_pair(i + 1, j + 1);
      val[i + 1][j + 1] = 0;
    }
  }
  while (q--) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      int r1, c1;
      r1 = p[r - 1][0].first;
      c1 = p[r - 1][0].second;
      for (int i = 0; i < m; i++) {
        if (i == m - 1) {
          p[r - 1][i].first = r1;
          p[r - 1][i].second = c1;
        } else {
          p[r - 1][i].first = p[r - 1][i + 1].first;
          p[r - 1][i].second = p[r - 1][i + 1].second;
        }
      }
    } else if (t == 2) {
      cin >> clear;
      int r1, c1;
      r1 = p[0][clear - 1].first;
      c1 = p[0][clear - 1].second;
      for (int i = 0; i < n; i++) {
        if (i == n - 1) {
          p[i][clear - 1].first = r1;
          p[i][clear - 1].second = c1;
        } else {
          p[i][clear - 1].first = p[i + 1][clear - 1].first;
          p[i][clear - 1].second = p[i + 1][clear - 1].second;
        }
      }
    } else {
      cin >> r >> clear >> v;
      int r1, c1;
      r1 = p[r - 1][clear - 1].first;
      c1 = p[r - 1][clear - 1].second;
      val[r1][c1] = v;
    }
  }
  for (i = 1; i < n + 1; i++) {
    for (j = 1; j < m + 1; j++) cout << val[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
