def init(m)
	$p = Array.new(2 * m + 1).map{Array.new(2 * m + 1 , false)}
end

def input_ways(m)
	$ways = Array.new
	$ways.push([0, 1])
	m.times do
		s, d = gets.chomp.split(" ").map{|str| str.to_i}
		$ways.push([s, d])
		$ways.push([d, s])
	end
	for i in 0..2 * m
		for j in 0..2 * m
			if $ways[i][1] == $ways[j][0] and $ways[i][0] != $ways[j][1]
				$p[i][j] = true
			end
		end
	end
end

def product(a, b)
	result = []
	if b[0].instance_of?(Array)
		for i in 0..a.size - 1
			result << []
			for j in 0..a[0].size - 1
				result[i] << false
				for k in 0..a[0].size - 1
					result[i][j] ||= a[k][j] && b[i][k]
				end
			end
		end
	else
		for i in 0..a.size - 1
			result << false
			for j in 0..a[0].size - 1
				result[i] ||= a[j][i] && b[j]
			end
		end
	end
	result
end



def pow(matrix, n)
#	print $counter += 1
	if n == 1
#		puts " case : n == 1"
		matrix
	elsif n % 2 == 0
#		puts "case : n % 2 == 0"
		pow(product(matrix, matrix), n / 2)
	else
#		puts "case : n % 2 != 0"
		product(matrix, pow(matrix, n - 1))
	end
end

def eval(n, m, z)
#	$counter = 0
#	puts "start_eval"
	result = false
	start = Array.new(2 * m + 1, false)
	start[0] = true
	product(pow($p, z), start).each_with_index do |value, i|
		if value == true and $ways[i][1] == n
			result = true
		end
	end
	result
end

def main()
	while (n, m, z = gets.chomp.split(" ").map{|str| str.to_i}) != [0, 0, 0]
		init(m)
		input_ways(m)
		puts eval(n, m, z) ? "yes" : "no"
	end
end

main()