#include #include #include #include #include #include #include #include using namespace std; typedef long long LL; const int INF = 1<<30; int getint() { int r = 0, k = 1; char c = getchar(); for (; '0' > c || c > '9'; c = getchar()) if (c == '-') k = -1; for (; '0' <= c && c <= '9'; c = getchar()) r = r * 10 - '0' + c; return r * k; } int main() { int T =getint(); while (T--) { int n = getint(); bool h0 = false, h1 = false; for (int i = 0; i < n; ++i) { int x = getint(); if (x == 0) h0 = true; if (x == 1) h1 = true; } if (h0 && h1) puts("YES"); else puts("NO"); } }