#include <bits/stdc++.h>
using namespace std;
double pi = acos(-1);
long long power(long long a, long long b) {
  long long p_res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      p_res *= a;
      b--;
    }
    a *= a;
    b /= 2;
  }
  return p_res;
}
int n, m;
int q;
int board[200][200];
int f1[11000][5];
int main() {
  cin >> n >> m >> q;
  int type, r, c, val;
  for (int i = 0; i < q; i++) {
    cin >> type;
    if (type == 1) {
      cin >> r;
      f1[i][0] = type;
      f1[i][1] = r;
    } else if (type == 2) {
      cin >> c;
      f1[i][0] = type;
      f1[i][1] = c;
    } else {
      cin >> r >> c >> val;
      f1[i][0] = type;
      f1[i][1] = r;
      f1[i][2] = c;
      f1[i][3] = val;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (f1[i][0] == 1) {
      int row = f1[i][1];
      int v = board[row][m];
      for (int j = m; j >= 2; j--) {
        board[row][j] = board[row][j - 1];
      }
      board[row][1] = v;
    } else if (f1[i][0] == 2) {
      int col = f1[i][1];
      int v = board[n][col];
      for (int j = n; j >= 2; j--) {
        board[j][col] = board[j - 1][col];
      }
      board[1][col] = v;
    } else {
      board[f1[i][1]][f1[i][2]] = f1[i][3];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << board[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
