The first line contains the number of schools N and the number of roads M. (2≤N≤1000, 1≤M≤10000)
The second line contains N space-separated characters. The i-th character is M if school i is a men-majority university and W if it is a women-majority university.
Each of the next M lines contains three integers u, v, and d, meaning that school u and school v are connected by a road of length d. (1≤u,v≤N, 1≤d≤1000)