YouarenowthecoordinatorfortheNonexistentOldRailwayStation!TheNonexistentOldRailwayStationonlyhasonetrackwithadeadend,whichactsasastack:everytimeyoueitherpushatrainintothestation,orpopthemostrecentlyaddedtrainoutofthestation.
Everyday,ntrainsgetspushintoandpopoutofthestation.Theinspectorhasalreadydecidedtoday'ssequenceofpushing''andpopping''.Younowhavealistofthecoloredtrainsandhavetoassigneachtraintoone``pushing''ininspector'ssequence.
Meanwhile,theinspectoralsorequiresyoutomakethesequenceoftrainsremainingonthetrackuniqueeverytimeyoupushatrainontoit.Twosequenceoftrainsareconsidereddifferentifthelengthisdifferentorthei-thtraininthetwosequenceshaveadifferentcolor.
Outputasolutionordecidethatitisimpossible.
Thefirstlinecontainsoneintegernn(1≤n≤1061≤n≤106),indicatingthenumberoftrains.Thesecondlinecontainsabracketsequenceoflength2n2n,witheach``(''indicatingone``pushing''and``)''indicatingone``popping''.Theinputguaranteesthatthesequenceisalwaysvalidandbalanced.Thethirdlinecontainsnnumberskiki(1≤ki≤n1≤ki≤n),indicatingthecoloroftheii-thtrain.输出描述:Ifthereisnosolution,output``NO''inoneline.Otherwise,output``YES''inthefirstline,andnnintergersinthesecondline,indicatingthecoloroftheii-thtrainthatisbeingpushed.题目大意是给定一个进出栈的序列,要求为这个序列的每个元素着色,使得每一次入栈操作发生后的栈内序列是两两不同的。