#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e;
int m[101][101];
int Q[10001][4];
const int INF = 2E9;
int main() {
  cin >> a >> b >> c;
  for (int i = 0; i < c; ++i) {
    cin >> Q[i][0] >> Q[i][1];
    if (Q[i][0] == 3) cin >> Q[i][2] >> Q[i][3];
  }
  for (int i = 0; i < a; ++i)
    for (int q = 0; q < b; ++q) m[i][q] = 0;
  for (int i = c - 1; i >= 0; --i) {
    if (Q[i][0] == 3) {
      m[Q[i][1] - 1][Q[i][2] - 1] = Q[i][3];
    } else if (Q[i][0] == 1) {
      int x = Q[i][1] - 1;
      swap(m[x][0], m[x][b - 1]);
      for (int q = b - 2; q > 0; --q) swap(m[x][q], m[x][q + 1]);
    } else {
      int y = Q[i][1] - 1;
      swap(m[0][y], m[a - 1][y]);
      for (int q = a - 2; q > 0; --q) swap(m[q][y], m[q + 1][y]);
    }
  }
  for (int i = 0; i < a; ++i) {
    for (int q = 0; q < b; ++q) cout << m[i][q] << ' ';
    cout << "\n";
  }
}
