#include <bits/stdc++.h>
long long int power(long long int x, long long int b) {
  long long int p = 1;
  while (b > 0) {
    if (b & 1) {
      p = p * x;
      p %= 9000000000000000000;
    }
    b >>= 1;
    x *= x;
    x %= 9000000000000000000;
  }
  return p % 9000000000000000000;
}
using namespace std;
struct lex_compare {
  bool operator()(
      const pair<long long int, pair<long long int, long long int> > p1,
      const pair<long long int, pair<long long int, long long int> > p2) {
    return (p1.first == p2.first) ? p1.second.first < p2.second.first
                                  : p1.first > p2.first;
  }
};
long double counts(long long int a, long long int b, long long int m) {
  long double c = 0;
  if (a % m == 0) {
    c = b / m - a / m + 1;
  } else
    c = b / m - a / m;
  c = (b - a + 1 - c);
  return c / (b - a + 1);
}
int main() {
  long long int n, m, q;
  cin >> n >> m >> q;
  long long int arr[n][m];
  memset(arr, 0, sizeof(arr));
  long long int queries[q][4];
  for (long long int i = 0; i < q; i++) {
    long long int t;
    cin >> t;
    queries[i][0] = t;
    if (t <= 2) {
      cin >> queries[i][1];
    } else {
      cin >> queries[i][1] >> queries[i][2] >> queries[i][3];
    }
  }
  for (long long int f = q - 1; f >= 0; f--) {
    long long int t = queries[f][0];
    if (t == 1) {
      long long int r = queries[f][1];
      r--;
      long long int temp = arr[r][m - 1];
      for (long long int i = m - 1; i >= 1; i--) {
        arr[r][i] = arr[r][i - 1];
      }
      arr[r][0] = temp;
    } else if (t == 2) {
      long long int c = queries[f][1];
      c--;
      long long int temp = arr[n - 1][c];
      for (long long int i = n - 1; i >= 1; i--) {
        arr[i][c] = arr[i - 1][c];
      }
      arr[0][c] = temp;
    } else {
      long long int r = queries[f][1], c = queries[f][2], x = queries[f][3];
      r--, c--;
      arr[r][c] = x;
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cout << arr[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
