#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,long long int>>answer;//kahas , 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,hel});
}
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<<" "<<"1 "<<answer[i].second << std::endl;
}
}
}
return 0;
}
I used heaps with pairs such that one can only add small no to the first number but i am getiing WA. kindly help me find out where is my mistake actually .
thankyou