#include <bits/stdc++.h>
using namespace std;
const int N6 = 1e6 + 6, N3 = 1e3 + 6, oo = 1e9 + 9, base = 1e9 + 7;
const long long ool = 1e18 + 9;
int n, m, q;
int a[N3][N3], qt[N6], x[N6];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= q; ++i) {
    cin >> qt[i];
    if (qt[i] == 1) {
      cin >> x[i];
      int w = a[x[i]][1];
      for (int j = 1; j <= m - 1; ++j) a[x[i]][j] = a[x[i]][j + 1];
      a[x[i]][m] = w;
    }
    if (qt[i] == 2) {
      cin >> x[i];
      int w = a[1][x[i]];
      for (int j = 1; j <= n - 1; ++j) a[j][x[i]] = a[j + 1][x[i]];
      a[n][x[i]] = w;
    }
    if (qt[i] == 3) {
      int r, c, val;
      cin >> r >> c >> val;
      a[r][c] = val;
    }
  }
  for (int i = q; i >= 1; --i) {
    if (qt[i] == 1) {
      int w = a[x[i]][m];
      for (int j = m; j >= 2; --j) a[x[i]][j] = a[x[i]][j - 1];
      a[x[i]][1] = w;
    }
    if (qt[i] == 2) {
      int w = a[n][x[i]];
      for (int j = n; j >= 2; --j) a[j][x[i]] = a[j - 1][x[i]];
      a[1][x[i]] = w;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
