#include #include #include #include #include #include #include #define LL long long #define pii pair #define piii pair #define xx first #define yy second #define ls rt << 1 #define rs rt << 1 | 1 #define lson ls, l, m #define rson rs, m + 1, r #define psi pair using namespace std; const int N = 100500; int main () { // freopen ("in.txt", "r", stdin); int T; cin >> T; while (T--) { int n, flag1 = 0, x, flag0 = 0; cin >> n; for (int i = 1; i <= n; i++) { scanf ("%d", &x); if (x == 1) flag1 = 1; if (x == 0) flag0 = 1; } cout << ((flag1 && flag0) ? "YES" : "NO") << endl; } }