1 #include <stdio.h> 2 #include <iostream> 3 #include <algorithm> 4 #include <set> 5 6 using namespace std; 7 8 int main () 9 { 10 int N; 11 cin >> N; 12 while(N --) 13 { 14 int M; 15 cin >> M; 16 int tmp_M = M; 17 set<pair<int,int>> s; 18 double m = 0; 19 while(tmp_M --) 20 { 21 int a,b; 22 cin >> a >> b; 23 m += a; 24 s.insert(make_pair(a,b)); 25 } 26 // cout << m << endl; 27 m /= M; 28 29 int flag = 1; 30 for(auto Ptr = s.begin();Ptr!=s.end();Ptr++) 31 { 32 int a = 2*m-Ptr->first; 33 int b = Ptr->second; 34 if(!s.count(make_pair(a,b))) 35 { 36 flag = 0; 37 break; 38 } 39 } 40 if(flag) 41 cout << "YES" << endl; 42 else 43 cout << "NO" << endl; 44 } 45 return 0; 46 }