import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) AB = np.fromstring(read(), np.int64, sep=' ') A = AB[::2] B = AB[1::2] L10 = np.log10(A) * B Z = L10.astype(int) x = np.exp((L10 - Z) * np.log(10)) X, Y = divmod((10*x).astype(int), 10) answers = ('{} {} {}'.format(*values) for values in zip(X,Y,Z)) print('\n'.join(answers))