#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

struct matrix{
  vector< vector<bool> > A;
  void use(int h, int w){
    for(int i = 0;i < h;++i)A.push_back(vector<bool> (w, 0));
    return;
  }
  void id(int n){
    for(int i = 0;i < n;++i)A.push_back(vector<bool> (n, 0));
    for(int i = 0;i < n;++i)A[i][i] = true;
    return;
  }
  matrix prod(matrix B){  //A * B.A
    matrix res;
    //if(A[0].size() != B.A.size()){ cout << "!!!error!!!\n"; return res; }
    res.use(A.size(), B.A[0].size());
    for(int i = 0;i < A.size();++i)for(int j = 0;j < B.A[0].size();++j)
    for(int k = 0;k < A[0].size();++k){
      res.A[i][j] = res.A[i][j] || (A[i][k] & B.A[k][j]);
    }
    return res;
  }
  matrix pow(int x){
    matrix res;
    //if(A.size() != A[0].size()){ cout << "!!!error!!!\n"; return res; }
    if(x == 0)res.id(A.size());
    else if(x == 1)res.A = A;
    else{
      res = pow(x / 2);
      res = res.prod(res);
      if(x % 2)res = prod(res);
    }
    return res;
  }
  void flip(int n){
    int i, j;
    bool tmp;
    rep(i, n)rep(j, n)if(i < j){
      tmp = A[i][j]; A[i][j] = A[j][i]; A[j][i] = tmp;
    }
    return;
  }
  void printer(int r, int c){
    cout << "debug" << endl;
    for(int i = 0;i < r;++i){
      for(int j = 0;j < c;++j)cout << A[i][j] << " ";
      cout << "\n";
    }
    return;
  }
};

struct edge{
  int to, num;
};

vector<edge> G[50];
matrix A, B;

signed main(void){
  int i, j, k, l;
  A.use(100, 100);
  B.use(100, 1);
  for(int testcase = 0;testcase >= 0;testcase++){
    int3(n, m, z);
    if(!(n | m | z))break;

    rep(i, 100)rep(j, 100)A.A[i][j] = false;
    rep(i, 100)B.A[i][0] = false;
    rep(i, m){
      int2(s, d);
      --s; --d;
      G[s].pb((edge){d, -1}); G[d].pb((edge){s, -1});
    }
    int cnt = 0;
    rep(i, n)rep(j, G[i].size())G[i][j].num = cnt++;

    rep(i, n)rep(j, G[i].size())rep(k, n)rep(l, G[k].size()){
      if(G[i][j].to == k && G[k][l].to != i)A.A[G[i][j].num][G[k][l].num] = true;
      if(G[k][l].to == i && G[i][j].to != k)A.A[G[k][l].num][G[i][j].num] = true;
    }

    A = A.pow(z - 1);
    A.flip(cnt);

    rep(j, G[0].size())B.A[G[0][j].num][0] = true;
    B = A.prod(B);

    bool res = false;
    rep(i, n)rep(j, G[i].size())if(G[i][j].to == n - 1)res = res || B.A[G[i][j].num][0];

    puts(res ? "yes" : "no");

    rep(i, n)G[i].clear();

//*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3180