#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const double pi = acos(-1);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
template <class T>
void _print(T arg) {
  cout << arg << " ";
}
template <class... Args>
void log(Args... args) {
  int arr[] = {(_print(args), 0)...};
  cout << endl;
}
int n, m, q;
struct Query {
  int op, r, c, x;
  void read() {
    cin >> op;
    if (op == 1) {
      cin >> r;
    } else if (op == 2) {
      cin >> c;
    } else {
      cin >> r >> c >> x;
    }
  }
} query[N];
int mp[105][105];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> q;
  int op, r, c, x;
  for (int i = 1; i <= q; ++i) {
    query[i].read();
  }
  for (int i = q; i; --i) {
    if (query[i].op == 1) {
      int r = query[i].r;
      int tmp = mp[r][m];
      for (int j = m; j; --j) {
        mp[r][j] = mp[r][j - 1];
      }
      mp[r][1] = tmp;
    } else if (query[i].op == 2) {
      int c = query[i].c;
      int tmp = mp[n][c];
      for (int j = n; j; --j) {
        mp[j][c] = mp[j - 1][c];
      }
      mp[1][c] = tmp;
    } else {
      mp[query[i].r][query[i].c] = query[i].x;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cout << mp[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
