#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000001;
int main() {
  int n, m, a[110][110] = {}, q, t;
  vector<int> v[10010];
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) a[i][j] = inf;
  for (int k = q; k; --k) {
    cin >> t;
    v[k].push_back(t);
    for (int i = 0; i < (t == 3 ? 3 : 1); ++i) {
      int x;
      cin >> x;
      v[k].push_back(x);
    }
  }
  for (int i = 1; i <= q; ++i) {
    if (v[i][0] == 3) {
      a[v[i][1]][v[i][2]] = v[i][3];
    } else if (v[i][0] == 1) {
      int tmp = a[v[i][1]][m];
      for (int j = m; j >= 2; --j) {
        a[v[i][1]][j] = a[v[i][1]][j - 1];
      }
      a[v[i][1]][1] = tmp;
    } else {
      int tmp = a[n][v[i][1]];
      for (int j = n; j >= 2; --j) {
        a[j][v[i][1]] = a[j - 1][v[i][1]];
      }
      a[1][v[i][1]] = tmp;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == inf) a[i][j] = 1;
      cout << a[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
