
// @snippet<sh19910711/contest:headers.cpp>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <limits>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>


// @snippet<sh19910711/contest:solution/interface.cpp>
namespace solution {
    class ISolution {
    public:
        virtual void init() {};
        virtual bool input() { return false; };
        virtual void output() {};
        virtual int run() = 0;
    };
}

// @snippet<sh19910711/contest:graph/config.cpp>
namespace graph {
    typedef int Weight;
    const Weight DEFAULT_WEIGHT = std::numeric_limits<Weight>().max() / 2;
}

// @snippet<sh19910711/contest:graph/interface.cpp>
namespace graph {
    class IGraph {
    public:
        virtual void init( int n ) = 0;
        virtual void addEdge( int from, int to ) = 0;
        virtual void addVertices() = 0;
        virtual void addEdges() = 0;
        virtual int countVertices() = 0;
        virtual Weight getEdgeCost( int from, int to ) = 0;
        virtual void setEdgeCost( int from, int to, Weight weight ) = 0;
        virtual Weight getVertexCost( int v ) = 0;
        virtual void setVertexCost( int v, Weight weight ) = 0;
    };
}

namespace graph {
    class AdjacentMatrixGraph: public IGraph {
    public:
        typedef std::vector<int> VI;
        typedef std::vector<VI> Matrix;
        typedef std::vector<Weight> Weights;
        typedef std::vector<Weights> WeightMatrix;
        Matrix edge_exists;
        int num;
        WeightMatrix edge_weights;
        Weights vertex_weights;

        void init( int n ) {
            num = n;
            edge_exists = Matrix( num, VI( num, 0 ) );
            edge_weights = WeightMatrix( num, VI( num, 0 ) );
            vertex_weights = Weights( num, 0 );
            addVertices();
            addEdges();
        }
        void addEdge( int from, int to ) {
            edge_exists[from][to] = 1;
        }
        int countVertices() {
            return num;
        }
        Weight getEdgeCost( int from, int to ) {
            return edge_weights[from][to];
        }
        void setEdgeCost( int from, int to, Weight weight ) {
            edge_weights[from][to] = weight;
        }
        Weight getVertexCost( int v ) {
            return vertex_weights[v];
        }
        void setVertexCost( int v, Weight weight ) {
            vertex_weights[v] = weight;
        }
        Matrix getMatrix() {
            return edge_exists;
        }
    };
}

// @snippet<sh19910711/contest:solution/solution.cpp>
namespace solution {
    using namespace std;

    typedef vector<int> VI;
    typedef vector<VI> VVI;
    typedef VVI Matrix;
    typedef pair<int, int> II;
    typedef vector<II> VII;

    const int EDGES = 51;
    const string YES = "yes";
    const string NO = "no";
    int n, m, z;
    int A[EDGES], B[EDGES];

    class Graph: public graph::AdjacentMatrixGraph {
    public:
        void addVertices() {
        }
        void addEdges() {
        }
    };

    Matrix GetIdentityMatrix( int n ) {
        Matrix res( n, VI( n, 0 ) );
        for ( int i = 0; i < n; ++ i )
            res[i][i] = 1;
        return res;
    }

    Matrix CalcMultiple( Matrix& A, Matrix& B ) {
        int n = A.size();
        Matrix res( n, VI( n, 0 ) );
        for ( int i = 0; i < n; ++ i )
            for ( int j = 0; j < n; ++ j )
                for ( int k = 0; k < n; ++ k )
                    res[i][j] = max( res[i][j], A[i][k] * B[k][j] );
        return res;
    }

    Matrix CalcPower( Matrix& A, int e ) {
        int n = A.size();
        Matrix res = GetIdentityMatrix(n);
        while ( e > 0 ) {
            if ( e % 2 )
                res = CalcMultiple( res, A );
            A = CalcMultiple( A, A );
            e /= 2;
        }
        return res;
    }
    
    class Solution: public ISolution {
    public:
        Graph G;
        
        bool input() {
            cin >> n >> m >> z;
            if ( n == 0 && m == 0 && z == 0 )
                return false;
            for ( int i = 0; i < m; ++ i ) {
                cin >> A[i] >> B[i];
            }
            return true;
        }
        bool solve() {
            VVI edge( n, VI( n, 0 ) );
            int vs = 2 * m + 1;
            VII v(vs);
            for ( int i = 0; i < m; ++ i ) {
                int a = A[i] - 1, b = B[i] - 1;
                edge[a][b] = edge[b][a] = 1;
                v[2*i+1] = II( a, b );
                v[2*i+2] = II( b, a );
            }
            v[0] = II( 0, -1 );

            G.init(vs);
            for ( int i = 0; i < vs; ++ i ) {
                for ( int j = 0; j < vs; ++ j ) {
                    II& a = v[i];
                    II& b = v[j];
                    if ( edge[a.first][b.first] && a.first == b.second && a.second != b.first )
                        G.addEdge( i, j );
                }
            }

            Matrix A = G.getMatrix();
            Matrix B = CalcPower( A, z );
            for ( int i = 0; i < vs; ++ i ) {
                if ( B[0][i] && v[i].first == n - 1 )
                    return true;
            }

            return false;
        }
        void output( bool result ) {
            cout << ( result ? YES : NO ) << endl;
        }
        int run() {
            while ( init(), input() ) {
                output(solve());
            }
            return 0;
        }
    };
}


// @snippet<sh19910711/contest:main.cpp>

int main() {
    return solution::Solution().run();
}