#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

struct Edge {
    int u, v;
};

typedef vector<Edge> Edges;
typedef vector<bool> Row;
typedef vector<Row> Matrix;

Matrix G;
Matrix mul(const Matrix& A, const Matrix& B) {
    Matrix res(A.size(), Row(B[0].size(), 0));
    REP(i, A.size()) REP(j, B[0].size()) REP(k, B.size()) {
        if ( A[i][k] && B[k][j] ) res[i][j] = true;
    }
    return res;
}
Matrix E(const int n) {
    Matrix res(n, Row(n, false));
    REP(i, n) res[i][i] = true;
    return res;
}
Matrix power(const Matrix& A, const int n) {
    Matrix x = A;
    Matrix res = E(A.size());
    for (ll i = 1; i <= n; i <<= 1) {
        if (i & n) {
            res = mul(res, x);
        }
        x = mul(x, x);
    }
    return res;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n, m, z;
    while (cin >> n >> m >> z, n || m || z) {
        Edges edges;
        vector<vector<int>> g(n);
        REP(i, m) {
            int u, v; cin >> u >> v; --u, --v;
            int eid = edges.size();
            edges.pb({u, v});
            g[u].pb(eid);
            g[v].pb(eid);
        }
        G.clear(); G.assign(m*2+n, Row(m*2+n, false));
        REP(i, edges.size()) {
            Edge& e = edges[i];
            EACH(j, g[e.u]) {
                if (i == j) continue;
                Edge& E = edges[j];
                if (E.u == e.u) {
                    G[i*2][j*2+1] = true;
                }
                else {
                    G[i*2][j*2] = true;
                }
            }
            EACH(j, g[e.v]) {
                if (i == j) continue;
                Edge& E = edges[j];
                if (E.u == e.v) {
                    G[i*2+1][j*2+1] = true;
                }
                else {
                    G[i*2+1][j*2] = true;
                }
            }
        }
        REP(i, n) {
            EACH(eid, g[i]) {
                Edge& e = edges[eid];
                if (edges[eid].u == i) {
                    G[m*2+i][eid*2+1] = true;
                }
                else {
                    G[m*2+i][eid*2] = true;
                }
            }
        }
        Matrix a = power(G, z);
        // cout << a.size() << " " << a[0].size() << endl;
        bool ans = false;
        int s = 0, t = n-1;
        REP(i, edges.size()) {
            Edge& e = edges[i];
            if (e.u == t && a[m*2+s][i*2]) {
                ans = true;
            }
            else if (e.v == t && a[m*2+s][i*2+1]) {
                ans = true;
            }
        }
        if ( ans ) {
            cout << "yes" << endl;
        }
        else {
            cout << "no" << endl;
        }
    }
}

Measured memory_bytes: 3048