from decimal import Decimal, getcontext, ROUND_FLOOR getcontext().prec = 50 # Adjusted precision for better performance def main(): import sys input = sys.stdin.read().split() n = int(input[0]) idx = 1 for _ in range(n): a = int(input[idx]) b = int(input[idx+1]) idx += 2 # Compute log10(A) using high precision log10_a = Decimal(a).ln() / Decimal(10).ln() log_ab = log10_a * Decimal(b) # Calculate Z and d z = int(log_ab // 1) d = log_ab - z # Compute 10^d with sufficient precision ten_d = Decimal(10) ** d # Round to two decimal places using floor ten_d_rounded = ten_d.quantize(Decimal('1.00'), rounding=ROUND_FLOOR) x = int(ten_d_rounded) y = int((ten_d_rounded - Decimal(x)) * Decimal(10)) print(x, y, z) if __name__ == "__main__": main()