import java.util.*; import java.io.*; class Main{ private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final PrintWriter out = new PrintWriter(System.out); public static void main(String[] args)throws IOException{ int T = Integer.parseInt(br.readLine()); while(T-->0){ int M = Integer.parseInt(br.readLine()); StringBuilder N = new StringBuilder(); String[] str = br.readLine().split(" "); for(int i=0;i<9;i++) for(int j=0;j