#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename T0>
void read(T &x, T0 &y) {
  cin >> x >> y;
}
template <typename T, typename T0, typename T1>
void read(T &x, T0 &y, T1 &z) {
  cin >> x >> y >> z;
}
template <typename T, typename T0, typename T1, typename T2>
void read(T &x, T0 &y, T1 &z, T2 &w) {
  cin >> x >> y >> z >> w;
}
template <typename T, typename T0>
void read(pair<T, T0> &p) {
  cin >> p.fst >> p.scd;
}
template <typename T>
void read(vector<T> &oneD) {
  for (long long int i = 0; i < (int)(oneD).size(); i++) {
    read(oneD[i]);
  }
}
template <typename T>
void read(T oneD[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    read(oneD[i]);
  }
}
template <typename T>
void write(T &x) {
  cout << x << " ";
}
template <typename T, typename T0>
void write(T &x, T0 &y) {
  cout << x << " " << y << "\n";
}
template <typename T, typename T0, typename T1>
void write(T &x, T0 &y, T1 &z) {
  cout << x << " " << y << " " << z << "\n";
}
template <typename T, typename T0, typename T1, typename T2>
void write(T &x, T0 &y, T1 &z, T2 &w) {
  cout << x << " " << y << " " << z << " " << w << "\n";
}
template <typename T, typename T0>
void write(pair<T, T0> &p) {
  write(p.fst);
  write(p.scd);
  cout << endl;
}
template <typename T>
void write(vector<T> &oneD) {
  for (long long int i = 0; i < (int)(oneD).size(); i++) {
    write(oneD[i]);
  }
  cout << endl;
}
template <typename T>
void write(T oneD[], int n) {
  for (long long int i = 0; i < n; i++) {
    write(oneD[i]);
  }
  cout << endl;
}
template <typename T, typename T0>
void write(map<T, T0> &mpp) {
  for (auto it : mpp) {
    write(it.fst);
    cout << ": ";
    write(it.scd);
    cout << "\n";
  }
  cout << endl;
}
template <typename T>
inline bool umax(T &x, T y) {
  return (y > x) ? x = y, true : false;
}
template <typename T>
inline bool umin(T &x, T y) {
  return (y < x) ? x = y, true : false;
}
template <class T>
void offset(long long int o, T &x) {
  x += o;
}
template <class T>
void offset(long long int o, vector<T> &x) {
  for (auto &a : x) offset(o, a);
}
template <class T, size_t S>
void offset(long long int o, array<T, S> &x) {
  for (auto &a : x) offset(o, a);
}
long long int FIRSTTRUE(function<bool(long long int)> f, long long int lb,
                        long long int rb) {
  while (lb < rb) {
    long long int mb = (lb + rb) / 2;
    f(mb) ? rb = mb : lb = mb + 1;
  }
  return lb;
}
long long int LASTTRUE(function<bool(long long int)> f, long long int lb,
                       long long int rb) {
  while (lb < rb) {
    long long int mb = (lb + rb + 1) / 2;
    f(mb) ? lb = mb : rb = mb - 1;
  }
  return lb;
}
inline bool isSquare(long long int x) {
  long long int s = sqrt(x);
  return (s * s == x);
}
inline bool isPowerOfTwo(long long int x) {
  return ((1LL << (long long int)log2(x)) == x);
}
long long int extended_GCD(long long int a, long long int b, long long int &x,
                           long long int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long int x1, y1;
  long long int gcd = extended_GCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
vector<long long int> prime;
void sieve(long long int N) {
  bool isPrime[N + !1];
  for (long long int i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long int i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (long long int j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
  for (long long int i = 2; i <= N; i++) {
    if (isPrime[i] == true) {
      prime.push_back(i);
    }
  }
}
long long int minPrime[(int)(1 * 1e6 + 10)];
void factorSieve(long long int n) {
  memset(minPrime, 0, sizeof(minPrime));
  for (long long int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {
      for (long long int j = i * i; j <= n; j += i) {
        if (minPrime[j] == 0) {
          minPrime[j] = i;
        }
      }
    }
  }
  for (long long int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
      minPrime[i] = i;
    }
  }
}
long long int factorize(long long int n) {
  map<long long int, long long int> m;
  m.clear();
  while (n != 1) {
    m[minPrime[n]]++;
    n /= minPrime[n];
  }
  for (auto i : m) {
    if (i.second > 1) {
      return 0;
    }
  }
  return 1;
}
long long int modinv(long long int a, long long int mod = 1000000007) {
  long long int x, y, g;
  g = extended_GCD(a, mod, x, y);
  if (g != 1)
    return -1;
  else {
    if (x < 0) x += mod;
    return x;
  }
}
long long int power(long long int a, long long int b,
                    long long int m = 1000000007) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
string to_string(char c) { return string(1, c); }
struct comp {
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    if (a.first == b.first) {
      return a.second > b.second;
    }
    return a.first < b.first;
  }
};
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first < b.first;
}
const long long int N = 2e5;
void solve() {
  long long int n;
  read(n);
  map<char, long long int> mp;
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
    string s;
    read(s);
    for (long long int j = (0);
         ((1) > 0 ? j < ((int)(s).size()) : j > ((int)(s).size())); j += (1)) {
      mp[s[j]]++;
    }
  }
  long long int flag = 0;
  for (auto &u : mp) {
    if (u.second % n != 0) flag = 1;
  }
  if (flag)
    cout << "NO";
  else
    cout << "YES";
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  read(t);
  for (long long int i = (0); ((1) > 0 ? i < (t) : i > (t)); i += (1)) {
    solve();
  }
}

### Prompt

Generate a cpp solution to the following problem:

You are given n strings s_1, s_2, …, s_n consisting of lowercase Latin letters.

In one operation you can remove a character from a string s_i and insert it to an arbitrary position in a string s_j (j may be equal to i). You may perform this operation any number of times. Is it possible to make all n strings equal?

Input

The first line contains t (1 ≤ t ≤ 10): the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 1000): the number of strings.

n lines follow, the i-th line contains s_i (1 ≤ \lvert s_i \rvert ≤ 1000).

The sum of lengths of all strings in all test cases does not exceed 1000.

Output

If it is possible to make the strings equal, print "YES" (without quotes).

Otherwise, print "NO" (without quotes).

You can output each character in either lowercase or uppercase.

Example

Input


4
2
caa
cbb
3
cba
cba
cbb
4
ccab
cbac
bca
acbcc
4
acb
caf
c
cbafc


Output


YES
NO
YES
NO

Note

In the first test case, you can do the following: 

  * Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively.
  * Remove the second character of the second string and insert it after the second character of the first string, making both strings equal to "cab". 



In the second test case, it is impossible to make all n strings equal.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename T0>
void read(T &x, T0 &y) {
  cin >> x >> y;
}
template <typename T, typename T0, typename T1>
void read(T &x, T0 &y, T1 &z) {
  cin >> x >> y >> z;
}
template <typename T, typename T0, typename T1, typename T2>
void read(T &x, T0 &y, T1 &z, T2 &w) {
  cin >> x >> y >> z >> w;
}
template <typename T, typename T0>
void read(pair<T, T0> &p) {
  cin >> p.fst >> p.scd;
}
template <typename T>
void read(vector<T> &oneD) {
  for (long long int i = 0; i < (int)(oneD).size(); i++) {
    read(oneD[i]);
  }
}
template <typename T>
void read(T oneD[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    read(oneD[i]);
  }
}
template <typename T>
void write(T &x) {
  cout << x << " ";
}
template <typename T, typename T0>
void write(T &x, T0 &y) {
  cout << x << " " << y << "\n";
}
template <typename T, typename T0, typename T1>
void write(T &x, T0 &y, T1 &z) {
  cout << x << " " << y << " " << z << "\n";
}
template <typename T, typename T0, typename T1, typename T2>
void write(T &x, T0 &y, T1 &z, T2 &w) {
  cout << x << " " << y << " " << z << " " << w << "\n";
}
template <typename T, typename T0>
void write(pair<T, T0> &p) {
  write(p.fst);
  write(p.scd);
  cout << endl;
}
template <typename T>
void write(vector<T> &oneD) {
  for (long long int i = 0; i < (int)(oneD).size(); i++) {
    write(oneD[i]);
  }
  cout << endl;
}
template <typename T>
void write(T oneD[], int n) {
  for (long long int i = 0; i < n; i++) {
    write(oneD[i]);
  }
  cout << endl;
}
template <typename T, typename T0>
void write(map<T, T0> &mpp) {
  for (auto it : mpp) {
    write(it.fst);
    cout << ": ";
    write(it.scd);
    cout << "\n";
  }
  cout << endl;
}
template <typename T>
inline bool umax(T &x, T y) {
  return (y > x) ? x = y, true : false;
}
template <typename T>
inline bool umin(T &x, T y) {
  return (y < x) ? x = y, true : false;
}
template <class T>
void offset(long long int o, T &x) {
  x += o;
}
template <class T>
void offset(long long int o, vector<T> &x) {
  for (auto &a : x) offset(o, a);
}
template <class T, size_t S>
void offset(long long int o, array<T, S> &x) {
  for (auto &a : x) offset(o, a);
}
long long int FIRSTTRUE(function<bool(long long int)> f, long long int lb,
                        long long int rb) {
  while (lb < rb) {
    long long int mb = (lb + rb) / 2;
    f(mb) ? rb = mb : lb = mb + 1;
  }
  return lb;
}
long long int LASTTRUE(function<bool(long long int)> f, long long int lb,
                       long long int rb) {
  while (lb < rb) {
    long long int mb = (lb + rb + 1) / 2;
    f(mb) ? lb = mb : rb = mb - 1;
  }
  return lb;
}
inline bool isSquare(long long int x) {
  long long int s = sqrt(x);
  return (s * s == x);
}
inline bool isPowerOfTwo(long long int x) {
  return ((1LL << (long long int)log2(x)) == x);
}
long long int extended_GCD(long long int a, long long int b, long long int &x,
                           long long int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long int x1, y1;
  long long int gcd = extended_GCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
vector<long long int> prime;
void sieve(long long int N) {
  bool isPrime[N + !1];
  for (long long int i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long int i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (long long int j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
  for (long long int i = 2; i <= N; i++) {
    if (isPrime[i] == true) {
      prime.push_back(i);
    }
  }
}
long long int minPrime[(int)(1 * 1e6 + 10)];
void factorSieve(long long int n) {
  memset(minPrime, 0, sizeof(minPrime));
  for (long long int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {
      for (long long int j = i * i; j <= n; j += i) {
        if (minPrime[j] == 0) {
          minPrime[j] = i;
        }
      }
    }
  }
  for (long long int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
      minPrime[i] = i;
    }
  }
}
long long int factorize(long long int n) {
  map<long long int, long long int> m;
  m.clear();
  while (n != 1) {
    m[minPrime[n]]++;
    n /= minPrime[n];
  }
  for (auto i : m) {
    if (i.second > 1) {
      return 0;
    }
  }
  return 1;
}
long long int modinv(long long int a, long long int mod = 1000000007) {
  long long int x, y, g;
  g = extended_GCD(a, mod, x, y);
  if (g != 1)
    return -1;
  else {
    if (x < 0) x += mod;
    return x;
  }
}
long long int power(long long int a, long long int b,
                    long long int m = 1000000007) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
string to_string(char c) { return string(1, c); }
struct comp {
  bool operator()(pair<long long int, long long int> a,
                  pair<long long int, long long int> b) {
    if (a.first == b.first) {
      return a.second > b.second;
    }
    return a.first < b.first;
  }
};
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  if (a.first == b.first) {
    return a.second > b.second;
  }
  return a.first < b.first;
}
const long long int N = 2e5;
void solve() {
  long long int n;
  read(n);
  map<char, long long int> mp;
  for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
    string s;
    read(s);
    for (long long int j = (0);
         ((1) > 0 ? j < ((int)(s).size()) : j > ((int)(s).size())); j += (1)) {
      mp[s[j]]++;
    }
  }
  long long int flag = 0;
  for (auto &u : mp) {
    if (u.second % n != 0) flag = 1;
  }
  if (flag)
    cout << "NO";
  else
    cout << "YES";
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  read(t);
  for (long long int i = (0); ((1) > 0 ? i < (t) : i > (t)); i += (1)) {
    solve();
  }
}

```