#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int q;
  cin >> q;
  while (q--) {
    int b, m, e;
    cin >> b >> m >> e;
    rotate(v.begin() + b, v.begin() + m, v.begin() + e);
  }
  for (int i = 0; i < n; i++) {
    if (i)
      cout << " ";
    cout << v[i];
  }
  cout << endl;
}
