#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
int n, m, q;
const int maxn = 110;
long long g[maxn][maxn];
long long t, a, b, c;
int main(void) {
  cin.sync_with_stdio(false);
  cin >> n >> m >> q;
  vector<pair<int, pair<int, pair<int, int> > > > v;
  for (int i = (0); i < (q); i++) {
    cin >> t;
    if (t == 1 || t == 2) {
      cin >> a;
      v.push_back(make_pair(t, make_pair(a, make_pair(0, 0))));
    } else {
      cin >> a >> b >> c;
      v.push_back(make_pair(t, make_pair(a, make_pair(b, c))));
    }
  }
  for (int i = (q - 1); i >= (0); i--) {
    pair<int, pair<int, pair<int, int> > > u = v[i];
    if (u.first == 3) {
      a = u.second.first;
      b = u.second.second.first;
      c = u.second.second.second;
      g[a - 1][b - 1] = c;
    } else {
      a = u.second.first;
      if (u.first == 1) {
        long long tmp = g[a - 1][m - 1];
        for (int j = (m - 1); j >= (1); j--) {
          g[a - 1][j] = g[a - 1][j - 1];
        }
        g[a - 1][0] = tmp;
      } else {
        long long tmp = g[n - 1][a - 1];
        for (int j = (n - 1); j >= (1); j--) {
          g[j][a - 1] = g[j - 1][a - 1];
        }
        g[0][a - 1] = tmp;
      }
    }
  }
  for (int i = (0); i < (n); i++) {
    for (int j = (0); j < (m); j++) {
      cout << g[i][j];
      if (j != m - 1)
        cout << ' ';
      else
        cout << endl;
    }
  }
  return 0;
}
