#include using namespace std; string days[] = {"saturday", "sunday", "monday", "tuesday", "wednesday", "thursday" , "friday"}; int main(){ int T; cin>>T; while(T--){ string s1 , s2; int L , R , A , B; cin>>s1>>s2>>L>>R; for(int j = 0 ; j < 7 ; j++){ if(days[j] == s1) A = j; if(days[j] == s2) B = j; } int dif = (B - A + 1 + 7)%7 , ans = -1; int times = 0; for(int weeks = 0 ; weeks < 100 ; weeks++){ if(dif >= L && dif <= R) { ++times; ans = dif; } dif += 7; } if(times > 1) cout<<"many"; else if(times == 0) cout<<"impossible"; else cout<