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 CFpracHim;
/**
 * @Author : lucent868
 * @Date : 5/12/21
 * @Time : 12:13 PM
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class PinCodesCF {
    static InputReader in;
    static PrintWriter w;

    public static void main(String args[]) {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    solve();
                    w.flush();
                    w.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();
    }

    public static void solve() {
        in = new InputReader(System.in);
        w = new PrintWriter(System.out);

        int t = in.nextInt();
        while (t-- > 0) {

            int n = in.nextInt();
            String s[] = new String[n];
            for(int i=0;i<n;i++)
                s[i] = in.readString();

            HashMap<String, Integer> hm =new HashMap<>();
            HashMap<String, Integer> fm =new HashMap<>();
            for(int i=0;i<n;i++)
            {
                if(hm.containsKey(s[i]) )
                    hm.put(s[i],hm.get(s[i])+1);
                else
                    hm.put(s[i],1);

            }
//            w.println(hm);

            StringBuffer sb = new StringBuffer("");
            int k=0;
            for(int i =0;i<n;i++)
            {
                if(hm.get(s[i]) == 1 || !fm.containsKey(s[i]))
                {
                    fm.put(s[i],1);
                    sb.append(s[i]+"\n");
                }
                else
                {
                    k++;
//                    if(!fm.containsKey(s[i]))
//                    {
//                        sb.append(s[i]+"\n");
//                        hm.put(s[i],hm.get(s[i])-1);
                        fm.put(s[i],1);
//                        continue;
//                    }




                    int f=0;
//                    for(int j = Integer.parseInt(s[i]);j<=9999&& f==0;j++)
//                    {
//                        String x = Integer.toString(j);
//                        while(x.length()<4)
//                            x="0"+x;
//
//                        if(!hm.containsKey(x))
//                        {
//                            hm.put(s[i],hm.get(s[i])-1);
//
//                            s[i] = x;
//                            f=1;
//                            break;
//                        }
//
//                    }
//                    for(int j = Integer.parseInt(s[i]);j>=0 && f==0;j--)
//                    {
//                        String x = Integer.toString(j);
//                        while(x.length()<4)
//                            x="0"+x;
//
//                        if(!hm.containsKey(x))
//                        {
//
//                            hm.put(s[i],hm.get(s[i])-1);
//
//                            s[i] = x;
//                            f=1;
//                            break;
//                        }
//
//                    }

                    for(int ii=0;ii<4;ii++ )
                    {
                        f=0;
                        int p = s[i].charAt(ii)-'0';
                        StringBuffer sss = new StringBuffer(s[i]);
                        for(int j=p;j<10;j++)
                        {
                            sss.replace(ii,ii+1,Integer.toString(j));
                            if(!hm.containsKey(sss.toString()))
                            {
                            hm.put(s[i],hm.get(s[i])-1);

                            s[i] = sss.toString();
                            f=1;
                            break;
                             }

                        }
                        for(int j=p;j>-1 && f==0;j--)
                        {

                            sss.replace(ii,ii+1,Integer.toString(j));
                            if(!hm.containsKey(sss.toString()))
                            {
                                hm.put(s[i],hm.get(s[i])-1);

                                s[i] = sss.toString();
                                f=1;
                                break;
                            }
                        }

                        if(f == 1)break;
                    }












                     sb.append(s[i]+"\n");

                    hm.put(s[i],1);



                }

            }
            w.println(k);
            w.print(sb);


        }


    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}