#include <bits/stdc++.h>
const int UndefinedNumber = 1e9 + 7;
enum QueryType { RowShift = 1, ColumnShift = 2, ValueAssign = 3 };
int rows, columns, queries_count;
std::vector<std::vector<int>> field;
std::vector<std::tuple<QueryType, int>> queries;
int ReadInt() {
  int x;
  std::cin >> x;
  return x;
}
void ShiftRowForward(int row_idx) {
  for (int i = 1; i < columns; ++i) {
    std::swap(field[row_idx][i - 1], field[row_idx][i]);
  }
}
void ShiftRowBackward(int row_idx) {
  for (int i = columns - 1; i > 0; --i) {
    std::swap(field[row_idx][i - 1], field[row_idx][i]);
  }
}
void ShiftColumnForward(int column_idx) {
  for (int i = 1; i < rows; ++i) {
    std::swap(field[i - 1][column_idx], field[i][column_idx]);
  }
}
void ShiftColumnBackward(int column_idx) {
  for (int i = rows - 1; i > 0; --i) {
    std::swap(field[i - 1][column_idx], field[i][column_idx]);
  }
}
void Solve() {
  for (int i = 0; i < queries_count; ++i) {
    int query_type = ReadInt();
    if (ValueAssign == query_type) {
      int row_idx = ReadInt() - 1, column_idx = ReadInt() - 1,
          value = ReadInt();
      assert(UndefinedNumber == field[row_idx][column_idx] ||
             value == field[row_idx][column_idx]);
      field[row_idx][column_idx] = value;
    } else {
      int idx = ReadInt() - 1;
      queries.push_back(
          std::make_tuple(static_cast<QueryType>(query_type), idx));
      if (RowShift == query_type) {
        ShiftRowForward(idx);
      }
      if (ColumnShift == query_type) {
        ShiftColumnForward(idx);
      }
    }
  }
  reverse(begin(queries), end(queries));
  for (const auto &query : queries) {
    QueryType query_type;
    int idx;
    std::tie(query_type, idx) = query;
    if (RowShift == query_type) {
      ShiftRowBackward(idx);
    }
    if (ColumnShift == query_type) {
      ShiftColumnBackward(idx);
    }
  }
}
void Read() {
  std::cin >> rows >> columns >> queries_count;
  field.assign(rows, std::vector<int>(columns, UndefinedNumber));
}
void Print() {
  for (int i = 0; i < rows; ++i) {
    for (int j = 0; j < columns; ++j) {
      std::cout << (field[i][j] == UndefinedNumber ? 0 : field[i][j]) << " ";
    }
    std::cout << std::endl;
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  Read();
  Solve();
  Print();
  return 0;
}
