#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:36777216")
const int Direction[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const char Letter[4] = {'U', 'R', 'D', 'L'};
const int Nmax = 300100;
int n, m, q;
int a[1111][1111];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> q;
  vector<pair<int, int> > list;
  for (int i = 1; i <= q; i++) {
    int t;
    cin >> t;
    if (t == 3) {
      int r, c, x;
      cin >> r >> c >> x;
      a[r][c] = x;
      continue;
    }
    if (t == 1) {
      int r;
      cin >> r;
      int temp = a[r][1];
      for (int j = 2; j <= m; j++) a[r][j - 1] = a[r][j];
      a[r][m] = temp;
      list.push_back(make_pair(1, r));
      continue;
    }
    if (t == 2) {
      int c;
      cin >> c;
      int temp = a[1][c];
      for (int j = 2; j <= n; j++) {
        a[j - 1][c] = a[j][c];
      }
      a[n][c] = temp;
      list.push_back(make_pair(2, c));
      continue;
    }
  }
  while (list.size() > 0) {
    int t = list.back().first;
    int r = list.back().second;
    list.pop_back();
    if (t == 1) {
      int temp = a[r][m];
      for (int i = m - 1; i >= 1; i--) a[r][i + 1] = a[r][i];
      a[r][1] = temp;
    } else if (t == 2) {
      int c = r;
      int temp = a[n][c];
      for (int i = n - 1; i >= 1; i--) a[i + 1][c] = a[i][c];
      a[1][c] = temp;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
