#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



const int MAX_COL = 110;
struct BitMatrix {
    int m;
    vector<bitset<MAX_COL> > val;
    BitMatrix(int n_ = 1, int m_ = 1) {m = m_; val.resize(n_, bitset<MAX_COL>(0));}
    void init(int n_, int m_) {m = m_; val.clear(); val.resize(n_, bitset<MAX_COL>(0));}
    inline int size() {return val.size();}
    inline bitset<MAX_COL>& operator [] (int i) {return val[i];}
    inline friend ostream& operator << (ostream& s, BitMatrix M) {
        s << endl; 
        for (int i = 0; i < M.val.size(); ++i) {
            for (int j = 0; j < M.m; ++j) s << M.val[i][j];
            s << endl;
        }
        return s;
    }
};

inline BitMatrix operator * (BitMatrix A, BitMatrix B) {
    BitMatrix R(A.size(), B.m);
    BitMatrix tB(B.m, B.size());
    for (int i = 0; i < B.m; ++i) for (int j = 0; j < B.size(); ++j) tB[i][j] = B[j][i];
    for (int i = 0; i < A.size(); ++i) 
        for (int j = 0; j < B.m; ++j) {
            R[i][j] = (A[i] & tB[j]).any();
        }
    return R;
}

inline BitMatrix pow(BitMatrix A, long long n) {
    BitMatrix R(A.size(), A.size());
    for (int i = 0; i < A.size(); ++i) R[i][i] = 1;
    while (n > 0) {
        if (n & 1) R = R * A;
        A = A * A;
        n >>= 1;
    }
    return R;
}


vector<pint> edges;
vector<pint> graph[110];

int N, M, Z, u, v;

int main() {
    //freopen( "/Users/macuser/Dropbox/Contest/input.in", "r", stdin );
    while (cin >> N >> M >> Z) {
        if (N == 0) break;
        edges.clear();
        for (int i = 0; i < 110; ++i) graph[i].clear();
        int it = 0;
        for (int i = 0; i < M; ++i) {
            cin >> u >> v; --u; --v;
            graph[u].PB(pint(v,it++)); edges.PB(pint(u,v));
            graph[v].PB(pint(u,it++)); edges.PB(pint(v,u));
        }
        BitMatrix A(M*2, M*2);
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < graph[i].size(); ++j) {
                int from = i;
                int to = graph[i][j].first;
                int it = graph[i][j].second;
                
                for (int k = 0; k < graph[to].size(); ++k) {
                    int nto = graph[to][k].first;
                    int nit = graph[to][k].second;
                    
                    if (nto == from) continue;
                    A[it][nit] = 1;
                }
            }
        }
        BitMatrix X = A;
        X = pow(A, Z-1);
        bool ok = false;
        for (int i = 0; i < M*2; ++i) for (int j = 0; j < M*2; ++j) {
            if (X[i][j] && edges[i].first == 0 && edges[j].second == N-1) ok = true;
        }
        
        //COUT(A); COUT(X);
        
        if (ok) puts("yes");
        else puts("no");
    }
    return 0;
}


Measured memory_bytes: 1176