import java.util.*

fun main(args:Array<String>):Unit {
    while(true){
        val (n, m, z) = readLine()!!.trim().split(' ').map(String::toInt)
        if ( n== 0 && m == 0 && z == 0) return
        val stations = Array(n){ Stack<Int>() }
        val rails = Array(m){
            val (s, d) = readLine()!!.trim().split(' ').map(String::toInt)
            stations[s - 1].push(it * 2)
            stations[d - 1].push(it * 2 + 1)
            Pair(s - 1, d - 1)
        }
        val newRails = Array(m * 2 + 1){Array(m * 2 + 1){false}}
        for (i in 0 until m){
            val (first, second) = rails[i]
            stations[second].filterNot{ it / 2 == i }.forEach { newRails[i * 2][it] = true }
            stations[first].filterNot { it / 2 == i }.forEach { newRails[i * 2 + 1][it] = true }
            if (first == 0) newRails[i * 2 + 1][m * 2] = true
            if (second == 0) newRails[i * 2][m * 2] = true
        }
        val res = exponent(newRails, z)
        println(if (stations.last().any{goal -> res[goal].last()}) "yes"
        else "no")
    }
}
fun exponent(base:Array<Array<Boolean>>, exp:Int):Array<Array<Boolean>> {
    return when(exp){
        1 -> base
        else -> exponent(base, exp / 2).let{if (exp % 2 == 1) it * it * base else it * it}
    }
}
operator fun Array<Array<Boolean>>.times(other:Array<Array<Boolean>>):Array<Array<Boolean>>{
    return this.map { booleans ->
        (0 until booleans.size).map{column -> (0 until this.size).any{booleans[it] && other[it][column]} }.toTypedArray()
    }.toTypedArray()
}
