#include <bits/stdc++.h>
using namespace std;

int main(void) {
	int n, x, q, b, m, e;
	vector<int> v;
	cin >> n;
	while (n--) {
		cin >> x;
		v.push_back(x);
	}
	cin >> q;
	while (q--) {
		cin >> b >> m >> e;
		rotate(v.begin() + b, v.begin() + m, v.begin() + e);
	}
	for (int i = 0; i < v.size(); i++) {
		if (i) cout << " ";
		cout << v[i];
	}
	cout << endl;
}
