My code is working fine on running but the testcases are showing run-error on submitting
import math
t = int(input())
for k in range(t):
l = list()
s = str()
m = int(input())
n = int(input())
for i in range(m,n+1):
flag = True
for j in range(2,int(math.sqrt(i))+1):
if i%j==0 :
#print(“Not Prime”)
flag = False
break
if flag==True :
s = s+str(i)+" "
print(s)