#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, q;
  cin >> n >> m >> q;
  long long vec[n + 1][m + 1];
  long long nooper[n + 1][m + 1];
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      nooper[i][j] = 0;
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      vec[i][j] = 0;
    }
  }
  vector<long long int> oper;
  for (long long i = 1; i <= q; ++i) {
    long long mn;
    cin >> mn;
    if (mn == 1) {
      long long row;
      cin >> row;
      for (long long i = 1; i <= m; ++i) ++(nooper[row][i]);
      row *= 10;
      oper.push_back(row);
    }
    if (mn == 2) {
      long long col;
      cin >> col;
      for (long long i = 1; i <= n; ++i) ++(nooper[i][col]);
      col = col * 10 + 1;
      oper.push_back(col);
    }
    if (mn == 3) {
      long long row, col, num;
      cin >> row >> col >> num;
      if (oper.empty())
        vec[row][col] = num;
      else {
        for (auto it = oper.rbegin(); it != oper.rend(); ++it) {
          if (*it % 10 == 0) {
            long long r = *it;
            r = r / 10;
            if (r == row) {
              if (col == m)
                col = 1;
              else
                col++;
            }
          }
          if (*it % 10 != 0) {
            long long c = *it;
            c = (c - 1) / 10;
            if (c == col) {
              if (row == n)
                row = 1;
              else
                row++;
            }
          }
        }
      }
      vec[row][col] = num;
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      cout << vec[i][j] << " ";
    }
    cout << '\n';
  }
}
