import sys from math import log10 sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) L = [0]+[log10(i/10) for i in range(1,100)] N = I() for _ in range(N): A,B = MI() W = B*log10(A) Z = int(W) XY = W-Z X,Y = 1,0 for i in range(10,100): if L[i] <= XY: X,Y = divmod(i,10) print(X,Y,Z)