#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  bool flag = true;
  if(a[a.size()-1] != b[0]) flag = false;
  if(b[b.size()-1] != c[0]) flag = false;
  if(flag) cout << "YES" << endl;
  else cout << "NO" << endl;
}
    #include <bits/stdc++.h>
                 
    using namespace std;
                         
    #define pb push_back
    #define pi 3.14159265358979323846
    #define ll long long
    #define mp make_pair
    #define pf push_front
    #define MOD 1000000007
    #define MAX 100000000
    #define MIN -1000000000
    #define LLINF 0x3f3f3f3f3f3f    
    #define INF 0x3f3f3f3f
    #define ld long double
    #define MAXN 1010
    #define MAXM 1010

    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int d, t, s;
        cin >> d >> t  >> s;
        if(s*t >= d){	
        	cout << "Yes" << endl;
        }else{	
        	cout << "No" << endl;
        }
        return 0;
    }
