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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    int q; cin >> q;
    while (q--) {
        int b, m, e; cin >> b >> m >> e;
        reverse(a.begin() + b, a.begin() + m);
        reverse(a.begin() + m, a.begin() + e);
        reverse(a.begin() + b, a.begin() + e);
    }
    int i = 0; for (int ai: a) cout << (i++ ? " " : "") << ai;
    cout << endl;
    return 0;
}
