#include <bits/stdc++.h>
using namespace std;
int a[111][111];
int t0[111111], t1[111111], t2[111111], t3[111111];
void solve(int test = 0) {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < q; ++i) {
    cin >> t0[i];
    if (t0[i] == 1) {
      cin >> t1[i];
    } else if (t0[i] == 2) {
      cin >> t1[i];
    } else {
      cin >> t1[i] >> t2[i] >> t3[i];
    }
  }
  for (int i = q - 1; i >= 0; --i) {
    int t = t0[i];
    if (t == 1) {
      int x = t1[i];
      x--;
      int w = a[x][m - 1];
      for (int i = m - 2; i >= 0; --i) {
        a[x][i + 1] = a[x][i];
      }
      a[x][0] = w;
    } else if (t == 2) {
      int x = t1[i];
      ;
      x--;
      int w = a[n - 1][x];
      for (int i = n - 2; i >= 0; --i) {
        a[i + 1][x] = a[i][x];
      }
      a[0][x] = w;
    } else {
      int x, y, qq;
      x = t1[i];
      y = t2[i];
      qq = t3[i];
      x--;
      y--;
      a[x][y] = qq;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ;
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
