import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { sb.append(getAns(sc.nextInt(), sc.nextInt())).append("\n"); } System.out.print(sb); } static String getAns(int x, int p) { return pow(new Num(x, 0), p).toString(); } static Num pow(Num x, int p) { if (p == 0) { return new Num(1, 0); } else if (p % 2 == 0) { return pow(x.pow2(), p / 2); } else { return pow(x, p - 1).multiply(x); } } static class Num { double value; long base; public Num(double value, long base) { while (value >= 10) { base++; value /= 10; } this.value = value; this.base = base; } public Num pow2() { return new Num(value * value, base * 2); } public Num multiply(Num x) { return new Num(value * x.value, base + x.base); } public String toString() { int ans = (int)(value * 10); StringBuilder sb = new StringBuilder(); sb.append(ans / 10).append(" ").append(ans % 10).append(" ").append(base); return sb.toString(); } } }