#C9199. Fault-Tolerant Network

    ID: 53265 Type: Default 1000ms 256MiB

Fault-Tolerant Network

Fault-Tolerant Network

You are given a network of n servers and m bidirectional communication channels connecting them. The network is said to be fault-tolerant at a level k if it satisfies the following conditions:

  • For every pair of distinct servers i and j, there exist at least k simple (non-repeating) paths between them.
  • If any one communication channel fails (i.e. is removed), then for every pair of servers, there remain at least k-1 simple paths connecting them.

In other words, in mathematical terms, for every pair of servers i and j the following should hold:

$$\#\{\text{simple paths from } i \text{ to } j\} \geq k $$

and after the failure of any edge e in the set of channels, we require:

$$\#\{\text{simple paths from } i \text{ to } j \text{ in } G \setminus \{e\}\} \geq k-1. $$

Your task is to determine if the given data transmission network is fault-tolerant as described above.

inputFormat

The first line of input contains three integers n, m, and k where

  • n (1 ≤ n ≤ 10) is the number of servers,
  • m is the number of communication channels, and
  • k (k ≥ 1) is the required fault tolerance level.

Each of the next m lines contains two integers u and v (1 ≤ u, v ≤ n) indicating that there is a bidirectional communication channel between server u and server v.

outputFormat

Output a single line containing yes if the network is fault-tolerant according to the criteria, or no otherwise.

## sample
5 6 2
1 2
2 3
3 4
4 5
5 1
1 3
yes