#include <bits/stdc++.h>
using namespace std;
int arr[102][102];
vector<int> rw, cl;
pair<int, int> p[10001];
pair<int, pair<int, int> > pp[10001];
int main() {
  int n, m, q, t, r, c, x;
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) arr[i][j] = 0;
  for (int i = 0; i < q; i++) {
    cin >> t;
    if (t == 1) {
      cin >> r;
      p[i].first = t, p[i].second = r;
    } else if (t == 2) {
      cin >> c;
      p[i].first = t, p[i].second = c;
    } else {
      cin >> r >> c >> x;
      p[i].first = t;
      pp[i].first = r, pp[i].second.first = c, pp[i].second.second = x;
    }
  }
  int q1, tmp, qq;
  for (int i = q - 1; i >= 0; i--) {
    if (p[i].first == 1) {
      for (int j = 0; j < m; j++) {
        if (j == 0) {
          q1 = arr[p[i].second - 1][0];
          arr[p[i].second - 1][0] = arr[p[i].second - 1][m - 1];
          continue;
        }
        tmp = q1;
        q1 = arr[p[i].second - 1][j];
        arr[p[i].second - 1][j] = tmp;
      }
    } else if (p[i].first == 2) {
      for (int j = 0; j < n; j++) {
        if (j == 0) {
          q1 = arr[0][p[i].second - 1];
          arr[0][p[i].second - 1] = arr[n - 1][p[i].second - 1];
          continue;
        }
        tmp = q1;
        q1 = arr[j][p[i].second - 1];
        arr[j][p[i].second - 1] = tmp;
      }
    } else {
      arr[pp[i].first - 1][pp[i].second.first - 1] = pp[i].second.second;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << arr[i][j] << " ";
    cout << endl;
  }
  return 0;
}
