Help me in solving BMC04 problem,

My issue

i did it right but still its showing me “max() arg is an empty sequence” . what to do

My code

# Update the '_' in the code below to solve the problem

t = int(input())
for i in range(t):
    A, B = map(int, input().split())
    
    # Create an empty list
    divisors_AandB = []     
    i = 1
    while i < min(A,B):
        #divides both A and B
        if A%i == 0 and B%i == 0:   
            #append the integer to the list
            divisors_AandB.append(i)    
        i = i + 1
    
    #gcd is the greatest common divisor
    gcd = max(divisors_AandB)
    #math property
    lcm = (A*B)//(gcd)
    
    print(gcd, lcm)

Learning course: Python for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone

you have wrong initialized i itration you have used it in both loop.
change outside for loop variable i by others.

Update the ‘_’ in the code below to solve the problem

t = int(input())
for _ in range(t):
A, B = map(int, input().split())

# Create an empty list
divisors_AandB = []     
i = 1
while i <= min(A,B):
    #divides both A and B
    if A%i == 0 and B%i == 0:   
        #append the integer to the list
        divisors_AandB.append(i)    
    i = i + 1

#gcd is the greatest common divisor
gcd = max(divisors_AandB)
#math property
lcm = (A*B)//(gcd)

print(gcd, lcm)