def exgcd(a,b,x,y):
if not b:
x,y = 1,0
return a,x,y
d,x,y = exgcd(b, a % b, y, x)
temp = y
y = x - a // b * y
x = temp
return d,x,y
if __name__ =='__main__':
x,y = 0,0
for i in range(int(input())):
a,b,m = map(int,input().split())
d,x,y = exgcd(a,m,x,y)
if b % d : print('impossible')
else:print( x * b // d % m )
为什么最后 int(x*(b/d)%m) 有错