Problem: A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0.

Polycarp has n (2 ≤ n ≤ 10) bank cards, the PIN code of the i-th card is p_i.

Polycarp has recently read a recommendation that it is better to set different PIN codes on different cards. Thus he wants to change the minimal number of digits in the PIN codes of his cards so that all n codes would become different.

Formally, in one step, Polycarp picks i-th card (1 ≤ i ≤ n), then in its PIN code p_i selects one position (from 1 to 4), and changes the digit in this position to any other. He needs to change the minimum number of digits so that all PIN codes become different.

Polycarp quickly solved this problem. Can you solve it?

Input

The first line contains integer t (1 ≤ t ≤ 100) — the number of test cases in the input. Then test cases follow.

The first line of each of t test sets contains a single integer n (2 ≤ n ≤ 10) — the number of Polycarp's bank cards. The next n lines contain the PIN codes p_1, p_2, ..., p_n — one per line. The length of each of them is 4. All PIN codes consist of digits only.

Output

Print the answers to t test sets. The answer to each set should consist of a n + 1 lines

In the first line print k — the least number of changes to make all PIN codes different. In the next n lines output the changed PIN codes in the order corresponding to their appearance in the input. If there are several optimal answers, print any of them.

Example

Input


3
2
1234
0600
2
1337
1337
4
3139
3139
3139
3139


Output


0
1234
0600
1
1337
1237
3
3139
3138
3939
6139

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(const char& ch) { return "'" + string(1, ch) + "'"; }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
template <typename T>
using mxpq = priority_queue<T>;
template <typename T>
using mnpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <class A, size_t S>
istream& operator>>(istream& in, array<A, S>& a) {
  for (A& x : a) in >> x;
  return in;
}
template <class A, size_t S>
ostream& operator<<(ostream& out, array<A, S>& a) {
  bool f = false;
  for (A& x : a) {
    if (f) out << " ";
    out << x;
    f = true;
  }
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (T& x : a) in >> x;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T>& a) {
  bool f = false;
  for (T& x : a) {
    if (f) out << " ";
    out << x;
    f = true;
  }
  return out;
}
void out(bool ok, bool cap = true) {
  if (cap)
    cout << (ok ? "YES" : "NO") << '\n';
  else
    cout << (ok ? "Yes" : "No") << '\n';
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const int64_t mod = 1e9 + 7;
const int64_t INF = 1e18L + 5;
const int64_t N = 2e5 + 5;
void solve() {
  int64_t n;
  cin >> n;
  map<string, int64_t> mp;
  vector<string> nums(n);
  cin >> nums;
  for (auto& num : nums) {
    mp[num]++;
  }
  int64_t changes = 0;
  for (auto& num : nums) {
    if (mp[num] > 1) {
      mp[num]--;
      bool replaced = 0;
      for (int64_t i = 0; i < 3; i++) {
        string s = num;
        s[i]++;
        while (s[i] <= '9') {
          if (mp[s] == 0) {
            num = s;
            replaced = 1;
            break;
          }
          s[i]++;
        }
        if (replaced) {
          break;
        }
        s = num;
        s[i]--;
        while (s[i] >= '0') {
          if (mp[s] == 0) {
            num = s;
            replaced = 1;
            break;
          }
          s[i]--;
        }
        if (replaced) {
          break;
        }
      }
      assert(replaced);
      changes++;
      mp[num]++;
    }
  }
  cout << changes << '\n';
  for (auto& num : nums) {
    cout << num << '\n';
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int64_t t = 1;
  cin >> t;
  for (int64_t tt = 1; tt <= t; tt++) solve();
  return 0;
}