Problem Code: Event

I am not able to find out any issue here in my code.
Can anybody please help me find out the problem in the code !!!

days = ['saturday', 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday']
for i in range(int(input())):
    all_dur = list()
    S,E,L,R = map(str, input().split())
    L = int(L)
    R = int(R)
    if days.index(S) < days.index(E):
        # currently this is minimum duration
        dur = (days.index(E) - days.index(S)) + 1
    else:
        # currently this is minimum duration
        dur = (len(days) - (days.index(S) + 1)) + (days.index(E)+1) + 1
    while dur <= R and len(all_dur) < 2:
        if dur >= L:
            all_dur.append(dur)
        dur += 7
    if len(all_dur) == 1:
        print(all_dur[0])
    elif len(all_dur) == 0:
        print("impossible")
    elif len(all_dur) > 1:
        print("many")