#include <bits/stdc++.h>
using namespace std;
int a[205][205];
int x[100200];
int y[100200];
int z[100200];
int kk[100020];
int i, j, k, m, n;
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) a[i][j] = 1000000020;
  for (i = 1; i <= k; i++) {
    cin >> x[i];
    if (x[i] == 1 || x[i] == 2)
      cin >> z[i];
    else
      cin >> y[i] >> z[i] >> kk[i];
  }
  for (i = k; i >= 1; i--) {
    if (x[i] == 1) {
      a[z[i]][0] = a[z[i]][m];
      for (int j = m; j >= 1; j--) a[z[i]][j] = a[z[i]][j - 1];
    } else if (x[i] == 2) {
      a[0][z[i]] = a[n][z[i]];
      for (int j = n; j >= 1; j--) a[j][z[i]] = a[j - 1][z[i]];
    } else {
      a[y[i]][z[i]] = kk[i];
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++)
      if (a[i][j] == 1000000020)
        cout << 0 << " ";
      else
        cout << a[i][j] << " ";
    cout << endl;
  }
}
