#include <bits/stdc++.h>
const long long inf = 1e9 + 5;
const long long linf = 5e18 + 5;
const long double eps = 1e-9;
const long long dd = 2e6 + 7;
const long long maxn = 2e3 + 10;
const long long mod = 1e9 + 7;
const long long cc = 1 << 19;
using namespace std;
int k[dd];
bool used[dd];
vector<pair<pair<int, int>, pair<int, int> > > qwe;
vector<vector<int> > asd;
int main() {
  ios_base::sync_with_stdio(0);
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  } else {
    if (!01) {
      freopen(
          "shopping"
          ".dat",
          "r", stdin);
      freopen(
          "shopping"
          ".sol",
          "w", stdout);
    }
  }
  int n, m, q;
  cin >> n >> m >> q;
  asd.assign(n, vector<int>(m, 0));
  for (long long i = 0; i < q; ++i) {
    int oper;
    cin >> oper;
    if (oper == 3) {
      int x, y, k;
      cin >> x >> y >> k;
      x--, y--;
      qwe.push_back(make_pair(make_pair(oper, k), make_pair(x, y)));
    } else {
      int x;
      cin >> x;
      x--;
      qwe.push_back(make_pair(make_pair(oper, -1), make_pair(x, -1)));
    }
  }
  reverse(qwe.begin(), qwe.end());
  for (long long i = 0; i < qwe.size(); ++i) {
    int oper = qwe[i].first.first;
    int x = qwe[i].second.first;
    int y = qwe[i].second.second;
    int k = qwe[i].first.second;
    if (oper == 3) {
      asd[x][y] = k;
    }
    if (oper == 2) {
      int s = asd[n - 1][x];
      for (int j = n - 1; j > 0; j--) asd[j][x] = asd[j - 1][x];
      asd[0][x] = s;
    }
    if (oper == 1) {
      int s = asd[x][m - 1];
      for (int j = m - 1; j > 0; j--) asd[x][j] = asd[x][j - 1];
      asd[x][0] = s;
    }
  }
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < m; ++j) cout << asd[i][j] << " \n"[j == m - 1];
  return 0;
}
