#pragma GCC optimize("unroll_loops")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> solve(std::vector<int> A){
ll n =A.size();
vector<int> p(n);
int i=n-1;
int id=0;
while(i>=0){
    p[id]=i;
    id++;
    i-=3;
    if(i<0) break;
    id++;
    p[id]=i;
    i--;
}
i=n-2;
while(i>=0){
    p[id]=i;
    id++;
    i-=3;
    if(i<0) break;
    id++;
    p[id]=i;
    i--;
}
return p;
}