def gcd(x,y): while y!=0: x,y=y,x%y return x def best_a_b(n): if n==2: return 1,1 if n%2==1: return n//2,n-n//2 half=n//2 a,b= half-1,half+1 if gcd(a,b)==1: return a,b return a-1,b+1 t=int(input()) for _ in range(t): n=int(input()) a,b=best_a_b(n) print(a,b) 注意题目要求,是要找符合条件的最大的最小公倍数。