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:
//swap(arr,i,j)
//HashMap sortByValue(map);
//long comb=nCr(5,2);
//int gcd(s,l);
//Pair p=new Pair(x,y);

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

public class Codeforces {

    InputStream is;
    PrintWriter out;
    String INPUT = "";

    //----------------------------------------------------------------------------------------------------//
    void solve() {
        int t = ni();
        for (int i = 0; i < t; i++) {
            int n = ni();
            Set<String> set = new HashSet<String>();
            Map<String, Integer> map = new HashMap<String, Integer>();
            String s[] = new String[n];
            for (int j = 0; j < n; j++) {
                s[j] = ns();
                if (!set.contains(s[j])) {
                    set.add(s[j]);
                } 
                    map.put(s[j], map.getOrDefault(s[j], 0) + 1);
                
            }
            int k = n - set.size();
            out.println(k);

            for (int l = 0; l < n; l++) {
                String str = s[l];
                if (map.get(s[l]) > 1) {
                    str = str.substring(0, 3);
                    for (int j = 0; j < 10; j++) {
                        if (!set.contains(str + j)) {
                            set.add(str + j);
                            str = str + j;
                            break;
                        }
                    }
                    map.put(s[l], map.get(s[l]) - 1);
                    s[l] = str;
                    
                }
                out.println(s[l]);
            }

        }

    }


    /*
    ${baseType type="java.util.List" default="List" editable="false"} <${type default="String"}> ${var newVarName default="l"} = new ${listType type="java.util.ArrayList" default="ArrayList" editable=false} <${type}>(${arg default="" instanceof="java.util.Collection"});
         ${cursor}
     */
//----------------------------------------------------------------------------------------------------//
    void swap(int a[], int l, int r) {
        int temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }

    long nCr(int n, int k) {
        long C[] = new long[k + 1];
        // nC0 is 1 
        C[0] = 1;
        for (int i = 1; i <= n; i++) {
            for (int j = Math.min(i, k); j > 0; j--) {
                C[j] = C[j] + C[j - 1];
            }
        }
        return C[k];
    }

    public int gcd(int s, int l) {
        if (s == 0) {
            return l;
        }

        return gcd(l % s, s);
    }

    public HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm) {
        // Create a list from elements of HashMap 
        List<Map.Entry<Integer, Integer>> list
                = new LinkedList<>(hm.entrySet());

        //->change o1,o2 for reverseorder
        Collections.sort(list, (Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) -> (o1.getValue()).compareTo(o2.getValue()));

        // put data from sorted list to hashmap  
        HashMap<Integer, Integer> temp = new LinkedHashMap<>();
        list.forEach((aa) -> {
            temp.put(aa.getKey(), aa.getValue());
        });
        return temp;
    }

    void run() throws Exception {
        is = System.in;//oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new Codeforces().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) {
            throw new InputMismatchException();
        }
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) {
                return -1;
            }
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b));
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) {
            map[i] = ns(m);
        }
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = ni();
        }
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (!oj) {
            System.out.println(Arrays.deepToString(o));

        }
    }

    class Pair {

        /*SORTING PAIRS BY COMPARING Y OF PAIR.
    Pair[] p=new Pair[n];
    p[i]=new Pair(i,ni());
    Arrays.sort(p,( p1, p2) -> {return p1.y-p2.y;});
         */
        int x;
        int y;

        Pair(int u, int v) {
            x = u;
            y = v;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (!(o instanceof Pair)) {
                return false;
            }
            Pair key = (Pair) o;
            return x == key.x && y == key.y;
        }

        @Override
        public int hashCode() {
            int result = x;
            result = 31 * result + y;
            return result;
        }

    }
}