#include
#include
using namespace std;
int N,M;
struct edge { int u,v,cost;
bool operator < (const edge& rhs) const
{
return cost < rhs.cost;
}
};
edge es[110];
int sett[110];
int find2(int x)
{
if(sett[x] == x ) return x;
else return sett[x] = find2(sett[x]);
}
void unite(int x,int y)
{
x =find2(x);
y =find2(y);
if(x