#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  while (a > 0 && b > 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return (a + b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
bool prime(T n) {
  if (n <= 1) {
    return false;
  }
  T i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      return false;
    }
    ++i;
  }
  return true;
}
const int maxN = 110;
const int maxM = (int)1e5 + 100;
int a[maxN][maxN];
int x[maxM], y[maxM], w[maxM], t[maxM];
void solveTask() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < q; ++i) {
    cin >> t[i];
    if (t[i] == 1 || t[i] == 2)
      cin >> x[i];
    else
      cin >> x[i] >> y[i] >> w[i];
  }
  for (int i = q - 1; i >= 0; --i) {
    if (t[i] == 3) {
      a[x[i] - 1][y[i] - 1] = w[i];
    } else if (t[i] == 1) {
      --x[i];
      int val = a[x[i]][m - 1];
      for (int j = m - 1; j >= 1; --j) a[x[i]][j] = a[x[i]][j - 1];
      a[x[i]][0] = val;
    } else {
      --x[i];
      int val = a[n - 1][x[i]];
      for (int j = n - 1; j >= 1; --j) a[j][x[i]] = a[j - 1][x[i]];
      a[0][x[i]] = val;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  solveTask();
  return 0;
}
