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:
import java.io.*;
import java.math.BigInteger;
import java.util.*;
 
public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long) (1e9+7);
	static long cf = 998244353;
    static final long MAX = (long) 1e8;
    public static List<Integer>[] edges;
    public static int[][] parent;
    
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt();
		    Map<String,List<Integer>> map = new HashMap<>();
		    
			//Pair[] p = new Pair[n];
		   
			String[] p = new String[n];
			Set<String> set = new HashSet<>();
			for(int i=0;i<n;++i) {
				p[i] = sc.next();
				
				set.add(p[i]);
				if(map.containsKey(p[i])) {
					map.get(p[i]).add(i);
				}else {
					List<Integer> list = new ArrayList<>();
					list.add(i);
					map.put(p[i], list);
				}
			}
			int k=0;
			for(String x : map.keySet()) {
				k+=map.get(x).size()-1;
			}
			
			for(String x : map.keySet()) {
				for(int i=1;i<map.get(x).size();++i) {
					change(set,x,map,p,map.get(x).get(i));
				}
			}
			out.println(k);
			for(int i=0;i<p.length;++i) out.println(p[i]);
			
			
			
		}
		out.close();
	}
	private static void change(Set<String> set, String x, Map<String, List<Integer>> map, String[] p,int idx) {
		
		for(int j=0;j<4;++j){
			char[] s = String.valueOf(x).toCharArray();
			for(char i='0';i<='9';++i) {
				s[j] = i;
				String n = new String(s);
				if(!set.contains(n)) {
					set.add(n);
					p[idx] = n;
					
					return;
				}
			}
		}
		
	}
	private static void add(Map<Integer, Integer> map, int i) {
		// TODO Auto-generated method stub
		if(map.containsKey(i)) map.put(i, map.get(i)+1);
		else map.put(i, 1);
		
	}
	private static void delete(Map<Integer, Integer> map, int i) {
		if(map.containsKey(i)) {
			if(map.get(i) == 1) map.remove(i);
			else map.put(i, map.get(i)-1);
		}
		
	}
	static class Pair{
		int num;
		int id;
		Pair(int num,int id){
			this.num = num;
			this.id = id;
		}
	}
}