There is no need to store the m, n values in any structure. You can simply do this:
t = int(input())
for _ in range(t):
m, n = input().split()
m, n = int(m), int(n)
for num in range(m, n+1):
#do something
But this will not speed up your code too much. There are at max ten test only cases, queueing will not consume much of the runtime....
please show your updated code.