#include <iostream>
#include<vector>
using namespace std;
//1 2 5 4
// 1 1 5 5
//2 1 4 5
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<long long> a(n);
long long sum=0;
for(int i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
}
if(sum%n != 0){
cout<<"NO"<<endl;
continue;
}
long long avg=sum/n;
//判断寄能量-平均能量是否为0
long long offset=0;
for(int i=0;i<n;i=i+2){
offset+=a[i]-avg;
}
if(offset==0){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}
// 64 位输出请用 printf("%lld")



京公网安备 11010502036488号