description: You are given a sequence of n integers a_1,   a_2,   ...,   a_n.
  
  Does there exist a sequence of n integers b_1,   b_2,   ...,   b_n such that the following property holds?
  
    * For each 1 ≤ i ≤ n, there exist two (not necessarily distinct) indices j and k (1 ≤ j,   k ≤ n) such that a_i = b_j - b_k. 
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 20) — the number of test cases. Then t test cases follow.
  
  The first line of each test case contains one integer n (1 ≤ n ≤ 10).
  
  The second line of each test case contains the n integers a_1,   ...,   a_n (-10^5 ≤ a_i ≤ 10^5).
  
  Output
  
  For each test case, output a line containing YES if a sequence b_1,   ...,   b_n satisfying the required property exists, and NO otherwise.
  
  Example
  
  Input
  
  
  5
  5
  4 -7 -1 5 10
  1
  0
  3
  1 10 100
  4
  -3 2 10 2
  9
  25 -171 250 174 152 242 100 -205 -258
  
  
  Output
  
  
  YES
  YES
  NO
  YES
  YES
  
  Note
  
  In the first test case, the sequence b = [-9,   2,   1,   3,   -2] satisfies the property. Indeed, the following holds: 
  
    * a_1 = 4 = 2 - (-2) = b_2 - b_5; 
    * a_2 = -7 = -9 - (-2) = b_1 - b_5; 
    * a_3 = -1 = 1 - 2 = b_3 - b_2; 
    * a_4 = 5 = 3 - (-2) = b_4 - b_5; 
    * a_5 = 10 = 1 - (-9) = b_3 - b_1. 
  
  
  
  In the second test case, it is sufficient to choose b = [0], since a_1 = 0 = 0 - 0 = b_1 - b_1.
  
  In the third test case, it is possible to show that no sequence b of length 3 satisfies the property.
solution: #include <bits/stdc++.h>
  using namespace std;
  const long long mod1 = (long long)1e9 + 7;
  const long long mod2 = 998244353;
  const long long MAXN = (long long)1e6 + 7;
  const long double pi = acos(-1);
  long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
  long long pow1(long long p, long long d, long long P) {
    return d ? (pow1(p * p % P, d >> 1, P) * (d & 1 ? p % P : 1)) % P : 1;
  }
  vector<long long> prime;
  bool is_composite[MAXN];
  void sieve(long long n) {
    std::fill(is_composite, is_composite + n, false);
    for (long long i = 2; i < n; ++i) {
      if (!is_composite[i]) prime.push_back(i);
      for (auto &p : prime) {
        if (i * p >= n) break;
        is_composite[i * p] = true;
        if (i % p == 0) break;
      }
    }
  }
  pair<long long, long long> ExtendedEuclid(long long a, long long b) {
    long long s1, s2, t1, t2;
    s1 = t2 = 1;
    s2 = t1 = 0;
    while (a % b != 0) {
      long long q = a / b;
      long long s3 = s2;
      s2 = s1 - q * s2;
      s1 = s3;
      s3 = t2;
      t2 = t1 - q * t2;
      t1 = s3;
      s3 = b;
      b = a % b;
      a = s3;
    }
    return {s2, t2};
  }
  void doit() {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < n; ++i) {
      cin >> a[i];
      a[i] = abs(a[i]);
    }
    if (*min_element(a.begin(), a.end()) == 0) {
      cout << "YES";
      return;
    }
    set<long long> sums;
    for (long long p = 0; p < (1 << n); ++p) {
      long long sum = 0;
      for (long long i = 0; i < n; ++i) {
        if (p & (1 << i)) sum += a[i];
      }
      if (sums.find(sum) != sums.end()) {
        cout << "YES";
        return;
      }
      sums.insert(sum);
    }
    cout << "NO";
  }
  int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    for (cin >> t; t--; cout << '\n') doit();
    return 0;
  }
  