package q1; import java.util.*; public class Main { public static TreeSet set = new TreeSet<>(); public static int iwai = 81181819; public static int[] ans = new int[iwai]; public static boolean[] vis = new boolean[iwai]; public static HashMap map = new HashMap<>(); public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); make(0); StringBuilder sb = new StringBuilder(); for(int i = 0;i < t;i++) { int n = sc.nextInt(); int rem = iwai - n; int ans = 0; StringBuilder a = new StringBuilder(); while(rem > 0) { int f = set.floor(rem); ans++; a.append(f + "\n"); rem -= f; }sb.append(ans + "\n" + a); } System.out.print(sb); }public static void make(int a) { if(a > iwai) { return; } if(a != 0) { set.add(a); make(a * 10); }make(a * 10 + 1); make(a * 10 + 8); } }