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

int main() {
  string A,B,C; cin >> A >> B >> C;
  int a,b,c;
  a = A.size();
  b = B.size();
  c = C.size();
  char s,t,u,v;
  s = A.at(a-1);
  t = B.at(0);
  u = B.at(b-1);
  v = C.at(0);
  if (s == t && v == u){
    cout << "YES";
  }
  else cout << "NO";
}
#include <iostream>
#include <numeric>

using namespace std;

const string YES = "POSSIBLE";
const string NO = "IMPOSSIBLE";

int main() {
  int N, K, M{}, D{}, A;
  cin >> N >> K;
  while (cin >> A) {
    M = max(M, A);
    if (D) D = gcd(D, A);
    else D = A;
  }
  cout << (K <= M && (M - K) % D == 0 ? YES : NO) << endl;
}
