```
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t;std::cin >> t;
while(t--){
priority_queue<pair<long long int,long long int>, vector<pair<long long int,long long int>>, greater<pair<long long int,long long int>>>heap;
long long int n;std::cin >> n;
long long int bada;
std::cin >> bada;
for(long long int i=1;i<n;i++){
long long int x;std::cin >> x;
heap.push({x,i});
}
std::vector<pair<long long int,pair<long long int,long long int>>>answer;//kahas , kahatak , kitna
bool canbe=true;
while(heap.size()){
long long int hel = heap.top().first;long long int kaha=heap.top().second;
heap.pop();
if(hel<=bada){
bada+=hel;
answer.push_back({kaha,{0,hel}});
}
else{
if(heap.size()){
long long int a1=heap.top().first;long long int b1=heap.top().second;
heap.pop();
int dif=a1-hel;
a1+=dif;
hel-=dif;
answer.push_back({kaha,{b1,dif}});
heap.push({hel,kaha});
heap.push({a1,b1});
}
else{
canbe=false;break;
}
}
}
if(canbe==false){
std::cout << -1 << std::endl;
}
else{
for(long long int i=0;i<answer.size();i++){
std::cout << (answer[i].first)+1<<" "<<(answer[i].second.first)+1<<" "<<answer[i].second.second << std::endl;
}
}
}
return 0;
}
```

finally got the actual way but still getting TLE , anyone can help where i am getting more time