#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& cout, const vector<T>& a) {
  if ((int)a.size() == 0) {
    return (cout << "()");
  }
  cout << "(" << a[0];
  for (int i = 1; i < (int)a.size(); i++) {
    cout << "; " << a[i];
  }
  return (cout << ")");
}
template <typename T>
ostream& operator<<(ostream& cout, const set<T>& a) {
  if ((int)a.size() == 0) {
    return (cout << "{}");
  }
  auto it = a.begin();
  cout << "{" << *it;
  ++it;
  for (; it != a.end(); ++it) {
    cout << "; " << *it;
  }
  return (cout << "}");
}
template <typename T>
ostream& operator<<(ostream& cout, const multiset<T>& a) {
  if ((int)a.size() == 0) {
    return (cout << "{}");
  }
  auto it = a.begin();
  cout << "{" << *it;
  ++it;
  for (; it != a.end(); ++it) {
    cout << "; " << *it;
  }
  return (cout << "}");
}
template <typename T1, typename T2>
ostream& operator<<(ostream& cout, const pair<T1, T2>& a) {
  return cout << "(" << a.first << "; " << a.second << ")";
}
const int nmax = 2000 * 1000;
const int inf = 2000 * 1000 * 1000;
const long long infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const long double pi = acos(-1.0);
int n, m, q, x[nmax], t[nmax], y[nmax], a[2000][2000], m1[nmax];
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < q; i++) {
    scanf("%d", &t[i]);
    if (t[i] == 1 || t[i] == 2) {
      scanf("%d", &x[i]);
      x[i]--;
    } else {
      scanf("%d%d%d", &x[i], &y[i], &m1[i]);
      x[i]--, y[i]--;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      a[i][j] = 0;
    }
  }
  for (int i = q - 1; i >= 0; i--) {
    if (t[i] == 1) {
      int lst = a[x[i]][m - 1];
      for (int j = m - 1; j > 0; j--) {
        a[x[i]][j] = a[x[i]][j - 1];
      }
      a[x[i]][0] = lst;
    } else if (t[i] == 2) {
      int lst = a[n - 1][x[i]];
      for (int j = n - 1; j > 0; j--) {
        a[j][x[i]] = a[j - 1][x[i]];
      }
      a[0][x[i]] = lst;
    } else {
      a[x[i]][y[i]] = m1[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%d ", a[i][j]);
    }
    printf("\n");
  }
}
