#include "testlib.h"
#include <bits/stdc++.h>
const int N=100000;
int T, n, m1, m2, nSum; std::string s;
int a[N+10];
void solve(){
	n = inf.readInt(1, 50000), nSum += n;
	if (nSum > N)
		quitf(_fail, "nSum > %d", N);
	for(int i=1;i<=n;i++)
		a[i]=inf.readInt(1,1000000000);
	for(int i=2;i<=n;i++)
		if(a[i]<a[i-1])
			quitf(_fail, "a[i-1] <= a[i] failed");
	if(a[1]+a[2]>a[n]){
		int x=ouf.readInt();
		if(x!=-1)
			quitf(_wa, "This test has no solution, but the output is not -1");
	}
	else{
		int x=ouf.readInt(1,n),y=ouf.readInt(x+1,n),z=ouf.readInt(y+1,n);
		if(a[x]+a[y]>a[z]){
			quitf(_wa, "(a[%d]=%d, a[%d]=%d, a[%d]=%d) can be a triangle.",x,a[x],y,a[y],z,a[z]);
		}
	}
}
int main(int argc, char* argv[]) {
	registerTestlibCmd(argc, argv);
	T = inf.readInt(1, N);
	while(T--)solve();
	quitf(_ok, "Accepted.");
	return 0;
}
