Project2:JumpingtheQueueThebeginningofawinterbreaknearSpringFestivalisalwaysthebeginningofapeakperiodoftransportation.Ifyouhaveevertriedtogetatrainticketatthattime,youmusthavewitnessedtheendlessqueuesinfrontofeveryticketboxwindow.Ifaguyhasseenhisfriendinaqueue,thenitisverymuchlikelythatthisluckyguymightgostraighttohisfriendandaskforafavor.Thisiscalled"jumpingthequeue".Itisunfairtotherestofthepeopleintheline,but,itislife.Yourtaskistowriteaprogramthatsimulatessuchaqueuewithpeoplejumpingineverynowandthen,assumethat,ifoneinthequeuehasseveralfriendsaskingforfavors,hewouldarrangetheirrequestsinaqueueofhisown.InputSpecification:Yourprogra妹妹ustreadtestcasesfromafile“input.txt”.Theinputfilewillcontainoneormoretestcases.Eachtestcasebeginswiththenumberofgroupsn(1<=n<=1000).Thenngroupdescriptionsfollow,eachoneconsistingofthenumberoffriendsbelongingtothegroupandthosepeople'sdistinctnames.Anameisastringofupto4characterschosenfrom{A,B,...,Z,a,b,...,z}.Agroupmayconsistofupto1000friends.Youmayassumethatthereisnoonebelongtotwodifferentgroups.Finally,alistofco妹妹andsfollows.Therearethreedifferentkindsofco妹妹ands: ENQUEUEX-Mr.orMs.Xgoesintothequeue DEQUEUE-thefirstpersongetstheticketandleavethequeue STOP-endoftestcaseTheinputwillbeterminatedbyavalueof0forn.OutputSpecification:Foreachtestcase,outputtoafile“output.txt”.Firstprintalinesaying"Scenario#k",wherekisthenumberofthetestcase.Then,foreachDEQUEUEco妹妹and,printthepersonwhojustgetsaticketonasingleline.Printablanklinebetweentwotestcases,butnoextralineattheendofoutput.SampleInput:23AnnBobJoe3ZoeJimFatENQUEUEAnnENQUEUEZoeENQUEUEBobENQUEUEJimE
1