My issues

the below code has passed the sample test case and i have also tried different cases and it gave me correct output

but still after submitting the code it is saying WRONG ANSWER

MY CODE

# cook your dish here

import math

t=int(input())

for i in range(t):

x,m=map(int, input().split())

digit=0

combine = 0

while x>0:

digit=x%10

s = math.pow(digit,m)

mod = s % 10

combine = combine * 10 + mod

x = x//10

```
if combine%7==0:
print("YES")
else:
print("NO")
```