there direct graph n color node m edge the node number 0 n 1you give string color colorsi lowercase english letter represent color ith node graph 0indexe you give 2d array edge edgesj aj bj indicate direct edge node aj node bjA valid path graph sequence node x1 x2 x3 xk direct edge xi xi1 1 k the color value path number node color frequently occur color pathreturn large color value valid path give graph 1 graph contain cycle Example 1input color abaca edge 01022334output 3explanation the path 0 2 3 4 contain 3 node color red imageExample 2input color edge 00output 1explanation there cycle 0 0 Constraintsn colorslengthm edgeslength1 n 1050 m 105colors consist lowercase English letters0 aj bj n