#include using ll = long long; using uint = unsigned; using namespace std; const int mxn = 2e5 + 10; int TestCase, f[mxn][3]; signed main() { for (scanf("%d", &TestCase); TestCase--;) { int n; scanf("%d", &n); vector a(n); for (int &x : a) scanf("%d", &x); vector tag; int last = a[0], len = 0; a.push_back(-1); for (int i = 0; i <= n; ++i) { if (a[i] == last) ++len; else { tag.push_back(len > 1); last = a[i], len = 1; } } auto solve = [&]() { // printf("size = %d\n", (int)tag.size()); if (tag.size() % 2 == 0) return puts("Yes"); for (int i = 1; i < (int)tag.size(); i += 2) if (tag[i]) return puts("Yes"); return puts("No"); }; solve(); } return 0; }