import math N = input() ans = 1e30 for i in range(N): a,b = map(int, raw_input().split()) P = math.log10(a) * b Z = int(math.log10(a) * b) XY = pow(10.0, (P - int(P))) print int(XY),int(int(XY * 10) % 10),Z