Alice Bob undirected graph n node type edgestype 1 can traverse Alice onlytype 2 can traverse Bob onlytype 3 can traverse Alice BobGiven array edge edgesi typei ui vi represent bidirectional edge type typei node ui vi find maximum number edge remove remove edge graph fully traverse Alice Bob the graph fully traverse Alice Bob start node reach nodesReturn maximum number edge remove return 1 Alice Bob fully traverse graph Example 1input n 4 edge 312323113124112234output 2explanation if remove 2 edge 112 113 the graph fully traversable Alice Bob remove additional edge so maximum number edge remove 2example 2input n 4 edge 312323114214output 0explanation notice remove edge graph fully traversable Alice BobExample 3input n 4 edge 323112234output 1explanation in current graph Alice reach node 4 node likewise Bob reach 1 therefore impossible graph fully traversable Constraints1 n 1051 edgeslength min105 3 n n 1 2edgesilength 31 typei 31 ui vi nAll tuple typei ui vi distinct