#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double pi = acos(-1.0);
const double eps = 1e-9;
int n, m, q, p, t[200100], a[200][200], x, y, c, first[200100];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= q; i++) {
    cin >> t[i];
    if (t[i] == 1) {
      cin >> x;
      p = a[x][1];
      for (int j = 1; j < m; j++) a[x][j] = a[x][j + 1];
      a[x][m] = p;
    } else if (t[i] == 2) {
      cin >> x;
      p = a[1][x];
      for (int j = 1; j < n; j++) a[j][x] = a[j + 1][x];
      a[n][x] = p;
    } else {
      cin >> x >> y >> c;
      a[x][y] = c;
    }
    first[i] = x;
  }
  for (int i = q; i >= 1; i--) {
    x = first[i];
    if (t[i] == 1) {
      p = a[x][m];
      for (int j = m - 1; j >= 1; j--) a[x][j + 1] = a[x][j];
      a[x][1] = p;
    } else if (t[i] == 2) {
      p = a[n][x];
      for (int j = n; j >= 1; j--) a[j + 1][x] = a[j][x];
      a[1][x] = p;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
