//B. Transfusion
#include <iostream>
#include <vector>
void solve(){
int n;
std::cin>>n;
int countOfOdd = (n+1)/2;
int countOfEven = n/2;
long long sumOfOdd=0;
long long sumOfEven=0;
for(int i = 0;i<n;i+=2){
int odd,even=0;
std::cin>>odd;
if(i+1<n){
std::cin>>even;
}
sumOfOdd+=odd;
sumOfEven+=even;
}
if(sumOfOdd%countOfOdd==0 && sumOfEven%countOfEven==0 && (sumOfOdd/countOfOdd)==(sumOfEven/countOfEven)){
std::cout<<"YES"<<std::endl;
}else{
std::cout<<"NO"<<std::endl;
}
}
int main(){
int t;
std::cin>>t;
while(t--){
solve();
}
}