#include using namespace std; #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for(int i=0; ib ? a=b, true : false; } using ll=long long; const int INF=1e9+10; const ll INFL=4e18; #ifdef DEBUG #include "./debug.hpp" #else #define debug(...) #define print_line #endif //---------------------------------------------------------- void solve() { int N; cin>>N; vector A(N); REP(i,N) cin>>A[i]; REP(i,N-2) { if(A[i]==A[i+2]) { puts("Yes"); return; } } REP(i,N-1) { if(A[i]==A[i+1]) { puts("Yes"); return; } } puts("No"); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //cout<>T; while(T--) solve(); }