Xayahh-Rakann at Moloco (Easy)

Given n jars and inseparable pairs, decide if exactly k jars can be kept so that no inseparable pair is split across the two groups.

Easy3Brute forceGraphBit manipulationNo attempts yetTime limit2sMemory limit512 MB

Problem

Moloco is an IT company, but a few of its employees have been running forbidden experiments on two kinds of unstable dark matter. They named the two kinds Xayahh-Rakann after an old legend about a couple who cannot be separated.

The employees produced nn units of unstable dark matter. Each unit sits in its own jar, and the jars are labeled 1 through nn.

After many experiments they found that certain pairs of jars must not be placed far apart. If such a pair is separated, the matter becomes unstable enough to explode and wipe out the planet. Those pairs are called inseparable pairs, and the employees identified mm of them. Every other pair is safe at any distance.

A renovation is scheduled for the building that currently stores the jars. The employees will keep exactly kk jars in the basement, which the renovation does not touch, and move the other nkn-k jars to a new office far from that building. If the two jars of an inseparable pair end up in different buildings, they explode.

Decide whether the jars can be split into a group of size kk and a group of size nkn-k safely.

Input

The first line contains three integers nn, mm, and kk. (1n201 \le n \le 20, 1k101 \le k \le 10, 1m1001 \le m \le 100)

Each of the next mm lines contains the labels of the two jars that form one inseparable pair. The two integers on a line are different and lie between 1 and nn. Line i+1i+1 describes the iith inseparable pair. The same pair may be given more than once, and kk may be larger than nn.

Output

Print SAFE on the first line if the jars can be split safely into a group of kk jars and a group of nkn-k jars. Otherwise print DOOMED.