#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const int mod = 1e9 + 7;
const long long LONGINF = 4e18;
const double eps = 1e-9;
const double PI = 3.1415926535897932384626433832795;
int a[111][111];
vector<pair<int, int> > V;
void solve() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      a[i][j] = 1;
    }
  }
  for (int i = 0; i < q; ++i) {
    int t, u, v, val;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &u);
      --u;
      for (int j = 0; j < m - 1; ++j) {
        swap(a[u][j], a[u][j + 1]);
      }
      V.push_back(make_pair(t, u));
    }
    if (t == 2) {
      scanf("%d", &u);
      --u;
      for (int j = 0; j < n - 1; ++j) {
        swap(a[j][u], a[j + 1][u]);
      }
      V.push_back(make_pair(t, u));
    }
    if (t == 3) {
      scanf("%d%d%d", &u, &v, &val);
      --u;
      --v;
      a[u][v] = val;
    }
  }
  while (!V.empty()) {
    if (V.back().first == 1) {
      for (int j = m - 1; j > 0; --j) {
        swap(a[V.back().second][j], a[V.back().second][j - 1]);
      }
    } else {
      for (int j = n - 1; j > 0; --j) {
        swap(a[j][V.back().second], a[j - 1][V.back().second]);
      }
    }
    V.pop_back();
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      printf("%d ", a[i][j]);
    }
    puts("");
  }
}
int main() {
  solve();
  return 0;
}
