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 JAVA):

Solution:
  //  package com.company;

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.math.BigInteger;
    //import java.nio.file.Paths;
    import java.util.*;

    public class Main {
        public static void main(String[] args) throws IOException {
            // write your code here
            // BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
        //BufferedReader s=new BufferedReader(new InputStreamReader(System.in));    StringBuilder sb = new StringBuilder();
       Scanner s=new Scanner(System.in);
       //     String[] str=s.readLine().trim().split("\\s+");
       int t=s.nextInt();
       while(t-->0){
           int n=s.nextInt();char[] [] a=new char[n][4];
           for(int i=0;i<n;i++){
               a[i]=s.next().toCharArray();
           }int flag=0;
           int ans=0;
      //     System.out.println(a[0][0]);
     //      System.out.println((char)(0));
           if(flag==0){
               HashMap<Character,Integer> h=new HashMap<Character, Integer>();
           for(int i=0;i<n;i++)   h.put(a[i][0],1);
               for(int i=0;i<n;i++){
                   int hu=0;int fu=0;
                   for(int k=0;k<n;k++){
                        if(i==k) continue;
                        hu=0;
                       for(int j=0;j<4;j++){
                       if(a[i][j]!=a[k][j]){
                           hu=1;break;
                       }
                   }if(hu==0) fu=1;
                   if(fu==1) break;
                   }if(fu==1){
                     //  System.out.println('H');
                       for(int j=0;j<10;j++){
                           if(!h.containsKey((char)(j+48))){
                          {

                                   h.put((char)(j+48),1);
                                   a[i][0]=(char)(j+48);ans++;break;
                               }
                           }
                       }
                   }}


           }System.out.println(ans);
           for(int i=0;i<n;i++){
               for(int j=0;j<4;j++){
                   System.out.print(a[i][j]);
               }
               System.out.println();
           }
       }
        }static int[] vis;
static int count;
static int[] flag;
static int another;
static int connected;static int huf=0;
static void dfs(int i,LinkedList<Integer> [] adj){
    connected++;
vis[i]=1;if(flag[i]==1) count++;
if(adj[i]!=null){
    for(int j:adj[i]){
        if(vis[j]==0){
            if(flag[i]==0) flag[j]=1; else flag[j]=0;

            dfs(j,adj);
    } else{
            if(flag[i]==flag[j]){
                huf=1;
            }
        }


    }}else{another++;}//return count;
}






      static  Boolean isCyclicUtil(int v, Boolean visited[], int parent,LinkedList[] adj)
        {
            // Mark the current node as visited
            visited[v] = true;
            Integer i;

            // Recur for all the vertices adjacent to this vertex
           if(adj[v]!=null){
            Iterator<Integer> it = adj[v].iterator();
            while (it.hasNext())
            {
                i = it.next();

                // If an adjacent is not visited, then recur for that
                // adjacent
                if (!visited[i])
                {
                    if (isCyclicUtil(i, visited, v,adj))
                        return true;
                }

                // If an adjacent is visited and not parent of current
                // vertex, then there is a cycle.
                else if (i != parent)
                    return true;
            }}
            return false;
        }

        // Returns true if the graph contains a cycle, else false.
        static Boolean isCyclic(int V,LinkedList<Integer>[] adj)
        {
            // Mark all the vertices as not visited and not part of
            // recursion stack
            Boolean visited[] = new Boolean[V];
            for (int i = 0; i < V; i++)
                visited[i] = false;

            // Call the recursive helper function to detect cycle in
            // different DFS trees
            for (int u = 0; u < V; u++)
                if (!visited[u]) // Don't recur for u if already visited
                    if (isCyclicUtil(u, visited, -1,adj))
                        return true;

            return false;
        }

    }

    class Student
    {
        int rollno;
        int color;

        // Constructor
        public Student(int rollno, int color)
        {
            this.rollno = rollno;

            this.color=color;}
        // Used to print student details in main()
        public String toString()
        {
            return this.rollno + " " ;
        }
    }

    class Sortbyroll implements Comparator<Student>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Student a, Student b)
        {
            return a.color - b.color;
        }
    }