Reconstructive Surgery
Due to an unfortunate incident with a pack of koalas around the Amber's Gully Walking Trail, all of Jamie's organs were destroyed. Dr. Ritisha just finished making Jamie some new ones, and now she needs to construct some veins to connect them.
Dr. Ritisha has made Jamie new organs, numbered
to
. Now, there are
possible veins she can construct, where each vein connects two distinct organs and has an integer length. No vein connects an organ to itself, and no two veins connect the same pair of organs.
Dr. Ritisha needs to pick a set of veins so that blood can flow between every pair of organs, directly or through other organs. More formally, she wants to choose veins so that the organs become part of one connected component, i.e. the resulting graph is connected.
Among all sets of veins that achieve this, Dr. Ritisha wants one whose total vein length is as small as possible. Call such a set a "plan".
There may be many possible plans. For each of the veins, determine whether it appears in all plans, in some plans but not all, or in no plan at all.
Input
The first line contains two integers and
(
,
), the number of organs and the number of veins Dr. Ritisha can choose from.
The next lines each contain three integers
,
and
(
,
,
), indicating that a vein of length
can be built between organs
and
. No two veins connect the same pair of organs.
It is guaranteed that the organs can all be connected using the available veins.
Output
For each vein, in the order they are given in the input, output all if the vein appears in all plans, some if it appears in some plans (but not all), and none if it appears in no plans. Each output should be on a separate line.
Example
Input 1
7 10
7 2 8
2 3 2
2 1 1
7 1 5
1 3 2
7 6 3
3 4 4
1 5 3
6 5 4
5 4 4
Output 1
none
some
all
none
some
all
some
all
all
some
Ritisha has veins available to connect the
organs.

The smallest total vein length required to connect all the organs is . There are
valid plans that achieve this, using the veins in various ways.

The veins ,
,
, and
appear in every plan, so their outputs are
all. Each plan chooses one of and
to connect organ
, and one of
and
to connect organ
, so these veins have output
some. The remaining two veins are never used in a plan, so their outputs are none.
Input 2
6 8
1 2 1
2 3 1
1 3 1
1 4 10
4 5 1
5 6 1
4 6 1
2 5 100
Output 2
some
some
some
all
some
some
some
none
Input 3
6 8
1 2 1
1 3 2
1 4 2
1 5 2
2 3 1
2 4 1
4 5 1
5 6 2
Output 3
all
none
none
none
all
all
all
all
Comments