#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	vector<int> vec; int an, tn, fn1, fn2, fn3; int set = 0;
	cin >> an; vec.resize(an); 
	for (int i = 0; i < an; i++) cin >> vec[i];
	cin >> tn;
	for (int i = 0; i < tn; i++) {
		cin >> fn1 >> fn2 >> fn3;
		rotate(vec.begin() + fn1, vec.begin() + fn2, vec.begin() + fn3);
	}
	for (int i : vec) cout << (set++ ? " " : "") << i;
	cout << endl;
	return 0;
}
