#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include<map>
typedef long long ll;
using namespace std;
void read(int &x){int f=1;x=0;char s=getchar();while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}x*=f;}
void write(int x){if(x<0){putchar('-');x=-x;}if(x>9)write(x/10);putchar(x%10+'0');}
int main(){
	char a[15],b[15],c[15];
	cin>>a>>b>>c;
	int l1=strlen(a);
	int l2=strlen(b);
	int l3=strlen(c);
	int f1=0,f2=0;
	if(a[l1-1]==b[0])f1=1;
	if(b[l2-1]==c[0])f2=1;
	if(f1&&f2){
		printf("Yes\n");
	//	printf("They form a word chain.\n");
	}
	else{
		printf("No\n");
	}
}