#include <bits/stdc++.h>
using namespace std;
const int maxn = int(1.5 * 1e7);
const int inf = 1e9 + 7;
const long long ll_inf = 1e18 + 420;
const double eps = 1e-4;
const int N = 1e6 + 7;
const int MAX = 2e5 + 9;
const int MOD = 1e9 + 7;
const long double pi = 3.14159265359;
long long fast_pow(int a, int b, int mod = 1e9 + 7) {
  long long res = a, ret = 1;
  while (b > 0) {
    if (b % 2) ret = (ret * res) % mod;
    res = (res * res) % mod;
    b /= 2;
  }
  return ret % mod;
}
long long fact(long long n, int mod = 1e9 + 7) {
  if (n == 1 || n == 0) return 1;
  return ((n % mod) * (fact(n - 1) % mod) % mod);
}
long long Cnk(long long n, long long r, int mod = 1e9 + 7) {
  return (fact(n) * fast_pow((fact(r) * fact(n - r)) % mod, mod - 2)) % mod;
}
int n, m, q, b[110][110];
pair<pair<int, int>, pair<int, int> > a[N];
void rec(int x, int y) {
  vector<int> h;
  if (x == 1) {
    for (int i = 1; i < m; ++i) {
      h.push_back(b[y][i]);
    }
    b[y][1] = b[y][m];
    for (int i = 2; i <= m; ++i) {
      b[y][i] = h[i - 2];
    }
  } else {
    for (int i = 1; i < n; ++i) {
      h.push_back(b[i][y]);
    }
    b[1][y] = b[n][y];
    for (int i = 2; i <= n; ++i) {
      b[i][y] = h[i - 2];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= q; ++i) {
    cin >> a[i].first.first;
    if (a[i].first.first == 1 || a[i].first.first == 2) {
      cin >> a[i].first.second;
    } else {
      cin >> a[i].first.second >> a[i].second.first >> a[i].second.second;
    }
  }
  for (int i = q; i >= 1; --i) {
    if (a[i].first.first == 1 || a[i].first.first == 2) {
      rec(a[i].first.first, a[i].first.second);
    } else {
      b[a[i].first.second][a[i].second.first] = a[i].second.second;
    }
  }
  for (int i = 1; i <= n; ++i, cout << endl) {
    for (int j = 1; j <= m; ++j, cout << " ") {
      cout << b[i][j];
    }
  }
}
