import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0; i < n; i++) { double a = sc.nextDouble(); double b = sc.nextDouble(); double t = b * (double)Math.log10(a); int z = (int)Math.floor(t); double t1 = t - (double)z; double t2 = (double)Math.pow(10, t1); String s = String.valueOf(t2); String x = String.valueOf(s.charAt(0)); String y = String.valueOf(s.charAt(2)); System.out.println(x + " " + y + " " + z); } } }