#include<bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(a) "(" << #a << ": " << (a) << ")"

template<typename T>
void chmin(T &x, T y) { x = min(x, y); }

template<typename T>
void chmax(T &x, T y) { x = max(x, y); }

typedef long long int lli;
typedef long double ld;
typedef tuple<int,int> P;

const int INF = INT_MAX/3;
const double EPS = 1e-14;
const int dx[4] = {0, 1, 0, -1}; // {-1,  0,  1, -1, 1, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0}; // {-1, -1, -1,  0, 0,  1, 1, 1};

const int mod = 1e9 + 7;

struct Mod {
  int num;
  Mod () : num(0) {;}
  Mod (int n) : num((n % mod + mod) % mod) {;}
  operator int() { return num; }
};

Mod operator+(Mod a, Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator-(Mod a, Mod b) { return Mod((mod + a.num - b.num) % mod); }
Mod operator*(Mod a, Mod b) { return Mod(((long long)a.num * b.num) % mod); }
Mod operator+=(Mod &a, Mod b) { return a = a + b; }
Mod operator-=(Mod &a, Mod b) { return a = a - b; }
Mod operator*=(Mod &a, Mod b) { return a = a * b; }
Mod operator^(Mod a, int n) {
  if (n == 0) return Mod(1);
  Mod res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
Mod inv(Mod a) { return a ^ (mod - 2); }
Mod operator/(Mod a, Mod b) { return a * inv(b); }

#define MAX_N 1024000

Mod fact[MAX_N], factinv[MAX_N];
void init() {
  fact[0] = Mod(1); factinv[0] = 1;
  REP(i,MAX_N-1) {
    fact[i+1] = fact[i] * Mod(i+1);
    factinv[i+1] = factinv[i] / Mod(i+1);
  }
}
Mod comb(int a, int b) {
  return fact[a] * factinv[b] * factinv[a-b];
}

template<typename T>
class Matrix {
  private:
    int m, n;
    vector<vector<T>> data;
  public:
    Matrix(const vector<vector<T>>& data_) :
      m(static_cast<int>(data_.size())), n(static_cast<int>(data_.front().size())), data(data_) {;}
    Matrix(const vector<T> &vec) :
      m(static_cast<int>(vec.size())), n(1), data(vector<vector<T>>(n, vector<T>(1))) {
        REP(i, m) { data[i][0] = vec[i]; }
      }
    Matrix(int n_) : m(n_), n(n_), data(vector<vector<T>>(n, vector<T>(n))) {;}
    Matrix(int m_, int n_) : m(m_), n(n_), data(vector<vector<T>>(m, vector<T>(n))) {;}
    const T& get(int i, int j) const { return data[i][j]; }
    T& get(int i, int j) { return data[i][j]; }
    int row() const { return m; }
    int colomn() const { return n; }
    Matrix transpose() const {
      Matrix result(colomn(), row());
      REP(i, row()) REP(j, colomn()) { result.get(j, i) = get(i, j); }
      return result;
    }

    static Matrix identity(int n) {
      Matrix I(n);
      REP(i, n) { I.get(i, i) = static_cast<T>(1); }
      return I;
    }

    const Matrix operator-() {
      Matrix result(row(), colomn());
      REP(i, row()) REP(j, colomn()) { result.get(i, j) = -get(i, j); }
      return result;
    }
    const Matrix operator+(const Matrix rhs) {
      int m = row(), n = colomn();
      if (m != rhs.row() || n != rhs.colomn()) {
        cerr << "cannot add (" << m << "x" << n << ") Matrix & (" << rhs.row() << "x" << rhs.colomn() << ") Matrix";
        throw;
      }
      Matrix result(m, n);
      REP(i, m) REP(j, n) { result.get(i, j) = get(i, j) + rhs.get(i, j); }
      return result;
    }
    const Matrix operator-(const Matrix &rhs) {
      return *this + (-rhs);
    }
    const Matrix operator*(const Matrix &rhs) {
      if (colomn() != rhs.row()) {
        cerr << "cannot multiply (" << row() << "x" << colomn() << ") Matrix & (" << rhs.row() << "x" << rhs.colomn() << ") Matrix";
        throw;
      }
      int m = row(), n = rhs.colomn();
      Matrix result(m, n);
      REP(i, m) REP(j, n) {
        REP(k, colomn()) { result.get(i, j) += get(i, k) * rhs.get(k, j); }
      }
      return result;
    }
    const Matrix operator*(T lambda) {
      Matrix result = this;
      REP(i, row()) REP(j, colomn()) { result.get(i, j) *= lambda; }
      return result;
    }
    const Matrix operator^(int n) {
      if (n == 0) return identity(row());
      if (n % 2 == 0) {
        Matrix square = (*this) * (*this);
        return square ^ (n / 2);
      }
      Matrix recurs = (*this) ^ (n - 1);
      return (*this) * recurs;
    }
};

template<typename T>
const Matrix<T> operator*(T lambda, const Matrix<T> &rhs) {
  return rhs * lambda;
}

template<typename T>
const Matrix<T> amendVertical(const Matrix<T> &upper, const Matrix<T> &lower) {
  if (upper.colomn() != lower.colomn()) {
    cerr << "cannot vertically amend (" << upper.row() << "x" << upper.colomn() << ") Matrix & ("
      << lower.row() << "x" << lower.colomn() << ") Matrix";
    throw;
  }
  int m1 = upper.row(), m2 = lower.row(), n = upper.colomn();
  Matrix<T> result(m1 + m2, n);
  REP(i, m1) REP(j, n) { result.get(i, j) = upper.get(i, j); }
  REP(i, m2) REP(j, n) { result.get(m1 + i, j) = lower.get(i, j); }
  return result;
}

template<typename T>
const Matrix<T> amendHorizontal(const Matrix<T> &left, const Matrix<T> &right) {
  if (left.row() != right.row()) {
    cerr << "cannot horizontally amend (" << left.row() << "x" << left.colomn() << ") Matrix & ("
      << right.row() << "x" << right.colomn() << ") Matrix";
    throw;
  }
  Matrix<T> trans = amendVertical(left.transpose(), right.transpose());
  return trans.transpose();
}

int main() {
  cout << fixed << setprecision(10);
  int N, M, Z;
  while (cin >> N >> M >> Z and Z) {
    Matrix<Mod> G(N, N);
    REP(i, M) {
      int s, d;
      cin >> s >> d;
      s--; d--;
      G.get(s, d) = G.get(d, s) = 1;
    }
    
    if (Z == 1) {
      cout << (G.get(0, N - 1) > 0 ? "yes" : "no") << endl;
      continue;
    }

    Matrix<Mod> L(N), G2 = G ^ 2;
    REP(i, N) {
      L.get(i, i) = -G2.get(i, i) + 1;
      G2.get(i, i) = 0;
    }

    Matrix<Mod> A = amendHorizontal(G, L), B = amendHorizontal(Matrix<Mod>::identity(N), Matrix<Mod>(N));
    A = amendVertical(A, B);
    Matrix<Mod> x = amendVertical(G2, G);

    A = A ^ (Z - 2);
    x = A * x;
    
    cout << ( x.get(0, N - 1) > 0 ? "yes" : "no") << endl;
  }
  return 0;
}

Measured memory_bytes: 12444