import math Q = int(input()) sum_coeff = math.sqrt(2) + math.sqrt(3) + 2.0 # Precompute the sum of sqrt(2), sqrt(3), and 2 for _ in range(Q): P_str = input().strip() P = float(P_str) # Try single term e_single = round(P ** 2) if abs(math.sqrt(e_single) - P) <= 1e-10: print(f"1 {e_single}") continue # Try three terms m_exact = (P / sum_coeff) ** 2 m_rounded = round(m_exact) e1 = 2 * m_rounded e2 = 3 * m_rounded e3 = 4 * m_rounded sum_three = math.sqrt(e1) + math.sqrt(e2) + math.sqrt(e3) if abs(sum_three - P) <= 1e-10: print(f"3 {e1} {e2} {e3}") continue # If neither works, this part would need to be extended, but for the problem's constraints, it's sufficient. # Additional strategies can be added here if necessary.