#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <bitset>
using namespace std;
inline void input(int &x) {
char c;
x = 0;
while ((c = getchar()) < '0' || c > '9');
while ('0' <= c && c <= '9') x = x * 10 + (c - '0'), c = getchar();
}
int n, a[55];
bool ans[55][55][55];
bitset<100> dp[15];
void init(int x, int y, int z) {
for (int i = 0; i <= 10; i++) dp[i].reset();
dp[0][0] = 1;
for (int i = 1; i <= n; i++) {
if (i == x || i == y || i == z || a[i] > 87) continue;
for (int j = 10; j >= 1; j--) dp[j] |= dp[j-1]<<a[i];
}
if (dp[10][87] == 1) ans[x][y][z] = 1;
else ans[x][y][z] = 0;
}
int main() {
int T;
input(T);
while (T--) {
input(n);
for (int i = 1; i <= n; i++) input(a[i]);
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
for (int k = j; k <= n; k++) {
init(i, j, k);
}
}
}
int Q, t[3];
input(Q);
while (Q--) {
input(t[0]); input(t[1]); input(t[2]);
sort(t, t + 3);
if (ans[t[0]][t[1]][t[2]]) puts("Yes");
else puts("No");
}
}
return 0;
}