#include <bits/stdc++.h>
using namespace std;
struct query {
  int t = 0, row = 0, col = 0;
  long long x = 0;
};
int n, m;
vector<vector<long long>> mat;
void rotate_row(int row) {
  long long temp = mat[row][m];
  for (int i = m; i > 1; i--) {
    mat[row][i] = mat[row][i - 1];
  }
  mat[row][1] = temp;
}
void rotate_col(int col) {
  long long temp = mat[n][col];
  for (int i = n; i > 1; i--) {
    mat[i][col] = mat[i - 1][col];
  }
  mat[1][col] = temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    long long q;
    cin >> n >> m >> q;
    for (int i = 0; i <= n; i++) {
      vector<long long> temp(m + 1, 0);
      mat.push_back(temp);
    }
    stack<query> s;
    while (q--) {
      int t, row, col;
      long long x;
      query temp;
      cin >> t;
      if (t == 1) {
        cin >> row;
        temp.t = t;
        temp.row = row;
      }
      if (t == 2) {
        cin >> col;
        temp.t = t;
        temp.col = col;
      }
      if (t == 3) {
        cin >> row >> col >> x;
        temp.row = row;
        temp.col = col;
        temp.x = x;
        temp.t = t;
      }
      s.push(temp);
    }
    while (!s.empty()) {
      int t = s.top().t;
      int row = s.top().row;
      int col = s.top().col;
      long long x = s.top().x;
      if (t == 1) {
        rotate_row(row);
      }
      if (t == 2) {
        rotate_col(col);
      }
      if (t == 3) {
        mat[row][col] = x;
      }
      s.pop();
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cout << mat[i][j] << " ";
      }
      cout << endl;
    }
  }
}
