Need help for this problem

There is a state with ๐‘› cities and ๐‘š uni-directional roads connecting those cities. One lowercase alphabet (โ€˜aโ€™-โ€˜zโ€™) is assigned to each city. We define a pathโ€™s value as the count of the most occurring letter. If letters on the cities encountered on a path are โ€œabbabaccaโ€, then the value of that path is 4 as โ€˜aโ€™ is the most frequent letter and its count is 4. Find the maximum possible value among all paths.

Input Format

The first line contains an integer T denoting the number of test cases. For each test case, first line contains two positive integers ๐‘› , ๐‘š (1โ‰ค๐‘›,๐‘šโ‰ค105), denoting that the state has ๐‘› cities and ๐‘š directed roads.

The second line contains a string ๐‘  with only lowercase letters. The ๐‘–th character is the letter assigned to the ๐‘–thcity.

Then ๐‘š lines follow. Each line contains two integers ๐‘ฅ,๐‘ฆ (1โ‰ค๐‘ฅ,๐‘ฆโ‰คn), describing a directed edge from ๐‘ฅ to ๐‘ฆ.

Constraints

1โ‰คn,mโ‰ค105

1โ‰คx,yโ‰คn

Output Format

Output a single integer denoting the largest value among all paths.

If the value can be inifnite, output -1 instead.