import math Q = int(input()) for _ in range(Q): P_str = input().strip() P = float(P_str) # Try single term e_single = P ** 2 e_single_rounded = round(e_single) if abs(math.sqrt(e_single_rounded) - P) <= 1e-10: print(1, e_single_rounded) continue # Try three terms with multipliers 1, 1.5, 2 S = 1 + math.sqrt(1.5) + math.sqrt(2) e_base = (P / S) ** 2 e_base_rounded = round(e_base) sum_test = math.sqrt(e_base_rounded) + math.sqrt(1.5 * e_base_rounded) + math.sqrt(2 * e_base_rounded) if abs(sum_test - P) <= 1e-10: print(3, int(e_base_rounded), int(1.5 * e_base_rounded), int(2 * e_base_rounded)) continue # Fallback: use single term with e_base_rounded (though not exact, but for demonstration) print(1, int(e_base_rounded))