#include <bits/stdc++.h>
using namespace std;
int n, m1, q;
int m[102][102];
struct query {
  int t;
  int a;
  int b;
  int c;
};
void rote(int type, int val) {
  if (type == 1) {
    int aux = m[val][m1];
    for (int i = m1 - 1; i >= 1; i--) m[val][i + 1] = m[val][i];
    m[val][1] = aux;
  } else {
    int aux = m[n][val];
    for (int i = n - 1; i >= 1; i--) m[i + 1][val] = m[i][val];
    m[1][val] = aux;
  }
}
int main() {
  cin >> n >> m1 >> q;
  stack<query> st;
  for (int i = 0; i < q; i++) {
    int in;
    cin >> in;
    if (in == 3) {
      int a, b, c;
      cin >> a >> b >> c;
      query qu;
      qu.t = in;
      qu.a = a;
      qu.b = b;
      qu.c = c;
      st.push(qu);
    } else {
      int a;
      cin >> a;
      query qu;
      qu.t = in;
      qu.a = a;
      st.push(qu);
    }
  }
  memset(m, 0, sizeof(m));
  while (!st.empty()) {
    int type = st.top().t;
    if (type == 3) {
      int x, y, v;
      x = st.top().b;
      y = st.top().a;
      v = st.top().c;
      st.pop();
      m[y][x] = v;
    } else {
      int a = st.top().a;
      st.pop();
      rote(type, a);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m1; j++) cout << m[i][j] << " ";
    cout << endl;
  }
}
