a game undirected graph play player Mouse Cat alternate turnsthe graph give follow grapha list nod b ab edge graphThe mouse start node 1 go cat start node 2 go second hole node 0During player turn travel edge graph meet for example Mouse node 1 travel node graph1additionally allow Cat travel Hole node 0then game end waysif Cat occupy node Mouse Cat winsIf Mouse reach Hole Mouse winsIf position repeat ie player position previous turn player turn game drawGiven graph assume player play optimally return1 mouse win game2 cat win game or0 game draw example 1input graph 25304514523023output 0example 2input graph 130302output 1 constraints3 graphlength 501 graphilength graphlength0 graphij graphlengthgraphij igraphi uniqueThe mouse cat