#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> vec;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        vec.push_back(x);
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; i++)
    {
        int b, m, e;
        cin >> b >> m >> e;
        rotate(vec.begin() + b, vec.begin() + m, vec.begin() + e);
    }
    for(int i = 0; i < n; i++)
    {
        if(i > 0) cout << " " << vec[i];
        else cout << vec[i];
    }
    cout << endl;
    return 0;
}


