http://tjuacm.chaosheng.top/problem.php?id=1264

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>

using namespace std;

const int N = 30;

int n;
int sticks[N];
bool used[N];
int edge;

bool dfs(int sum, int number, int index){
    if(number == 3) return true;
    for(int i = index; i < n; i++){
        if(used[i] || sum + sticks[i] > edge) continue;
        used[i] = true;
        if(sum + sticks[i] == edge){
            if(dfs(0, number + 1, 0)){
               return true;    
            }
        }
        else{
            if(dfs(sum + sticks[i], number, i + 1)){
                return true;
            }
        }
        used[i] = false;
    }
    return false;
} 

bool cmp(int x, int y){
    return x > y;
}

int main(){
    int t;
    cin >> t;
    while(t--){
        cin >> n;
        int sum = 0;
        for(int i = 0; i < n; i++){
            cin >> sticks[i];
            sum += sticks[i];
        }
        memset(used, false, sizeof(used));
        sort(sticks, sticks + n, cmp);
        if(sum % 4 != 0){
            cout << "no" << endl;
            continue;
        }else{
            edge = sum / 4;
            if(sticks[n-1] > edge){
                cout << "no" << endl;
                continue;
            }
        }

        if(dfs(0, 0, 0)) printf("yes\n");
        else printf("no\n");    
    }
    return 0;
}