At one point, there was a president who traveled around Japan to do business. One day he got a mysterious ticket. If you use the ticket, the train fare will be free regardless of the distance to the destination. However, when moving from the current station to the adjacent station is counted as one step, if the number of steps to move is not exactly equal to the number written on the ticket, an additional fee will be charged. It is forbidden to move around a section immediately, but it is permissible to go through a station or section that you have already visited multiple times. For example, you cannot move to station 1, station 2, or station 1, but there is no problem with moving to station 1, station 2, station 3, station 1, or station 2. Also, if you finally arrive at your destination, you may go through the starting point and destination as many times as you like.

The president immediately decided to use this ticket to go to his next destination. However, since the route map is complicated, the route cannot be easily determined. Your job is to write a program on behalf of the president to determine if you can reach your destination for free.

Stations are numbered from 1 to N, with the departure station being 1 and the destination station being N. The route map is given by the row of sections connecting the two stations. The section can pass in either direction. It is guaranteed that there is no section connecting the same stations and that there is at most one section connecting a pair of stations.



Input

The input consists of multiple datasets.

Each dataset is given in the following format.

N M Z
s1 d1
s2 d2
...
sM dM

N is the total number of stations, M is the total number of sections, and Z is the number of steps written on the ticket. si and di (1 ≤ i ≤ M) are integers representing station numbers, indicating that there is an interval between station si and station di, respectively.

N, M, Z are positive integers and satisfy the following conditions: 2 ≤ N ≤ 50, 1 ≤ M ≤ 50, 0 <Z <231.

After the last dataset, there is a line that says "` 0 0 0 `".

The number of datasets does not exceed 30.

Output

For each dataset, output a one-line string containing only "` yes` "if the destination can be reached with just the number of steps written on the ticket, or" `no`" if not. ..

Example

Input

2 1 1
1 2
2 1 2
1 2
3 1 2
1 2
8 8 5778
1 2
2 3
2 4
3 5
5 6
6 7
7 8
4 8
8 8 5777
1 2
2 3
2 4
3 5
5 6
6 7
7 8
4 8
0 0 0


Output

yes
no
no
yes
no
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef long long ll;

int N, M, Z;
int tt[200][200], t[200][200];
map<P,int> idx;
P ridx[200];

const int MOD = 10000;

mat mul(mat &A, mat &B){
  mat C(A.size(), vec(B[0].size()));
  for(int i = 0; i < A.size(); i++){
    for(int k = 0; k < B.size(); k++){
      for(int j = 0; j < B[0].size(); j++){
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }
  return C;
}

mat pow(mat A, ll n){
  mat B(A.size(), vec(A.size()));

  for(int i = 0; i < A.size(); i++){
    B[i][i] = 1;
  }
  while(n > 0){
    if(n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }
  return B;
}

int main(){
  while(cin >> N >> M >> Z, N || M || Z){
    memset(tt, 0, sizeof(tt));
    idx.clear();

    for(int i = 1; i <= N; i++){
      int size = idx.size();
      idx[P(i, 0)] = size;
      ridx[size] = P(i, 0);
    }

    for(int i = 0; i < M; i++){
      int a, b;
      cin >> a >> b;
      tt[a][b] = tt[b][a] = true;

      int size = idx.size();
      idx[P(a, b)] = size;
      idx[P(b, a)] = size + 1;

      ridx[size] = P(a, b);
      ridx[size + 1] = P(b, a);
    }

    memset(t, 0, sizeof(t));

    for(int i = 1; i <= N; i++){ //今いる位置
      for(int j = 0; j <= N; j++){ //前いた位置
        if(j != 0 && !tt[i][j]) continue;
        if(idx.find(P(i, j)) == idx.end()) continue;

        int from = idx[P(i, j)];

        for(int k = 1; k <= N; k++){
          if(i == k || k == j) continue;
          if(!tt[i][k]) continue;
          if(idx.find(P(k, i)) == idx.end()) continue;

          int to = idx[P(k, i)];

          t[from][to] = true;
        }
      }
    }

    mat A;

    for(int i = 0; i < idx.size(); i++){
      vec v;
      for(int j = 0; j < idx.size(); j++){
        v.push_back(t[i][j]);
      }
      A.push_back(v);
    }

    mat ans = pow(A, Z);
    bool flg = false;

    for(int j = 0; j < idx.size(); j++){
      if(ans[0][j] > 0 && ridx[j].first == N){
        flg = true;
        break;
      }
    }

    cout << (flg ? "yes" : "no") << endl;
  }
}