void solve(){
int n; cin>>n;
vi v(n); rep(i,0,n) cin>>v[i];
int flag=1;
rep(i,0,n/2){
if(v[i]!=v[n-1-i]) {
flag=0; break;
}
}
if(flag){
yes
return;
}
string s="";
for(int i=0;i<n;i++)
if(v[i]!=v[0]) s=s+to_string(v[i]);
string s2=s;
reverse(s2.begin(),s2.end());
if(s==s2)
{
yes return;
}
s="";
for(int i=0;i<n;i++)
if(v[i]!=v[n-1]) s=s+to_string(v[i]);
s2=s;
reverse(s2.begin(),s2.end());
if(s==s2)
{
yes return;
}
no
}