You are given three strings A, B and C. Check whether they form a word chain.

More formally, determine whether both of the following are true:

* The last character in A and the initial character in B are the same.
* The last character in B and the initial character in C are the same.



If both are true, print `YES`. Otherwise, print `NO`.

Constraints

* A, B and C are all composed of lowercase English letters (`a` - `z`).
* 1 ≤ |A|, |B|, |C| ≤ 10, where |A|, |B| and |C| are the lengths of A, B and C, respectively.

Input

Input is given from Standard Input in the following format:


A B C


Output

Print `YES` or `NO`.

Examples

Input

rng gorilla apple


Output

YES


Input

yakiniku unagi sushi


Output

NO


Input

a a a


Output

YES


Input

aaaaaaaaab aaaaaaaaaa aaaaaaaaab


Output

NO
#include <bits/stdc++.h>


#define itn int
#define LL long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(x) (x).begin(), (x) end()
#define sz(x) (int)((x).size())
#define REP(i,a,b) for(int i = a ; i <= b; i ++)

using namespace std;
inline int GetInt(){
	int x;
	scanf("%d" , &x);
	return x;
}
inline string GetString(void){
	char x[100005];
	scanf("%s",x); string s = x;
	return s;
}
void solve(){
	string a,b,c;
	cin >> a >> b >> c;
	if(a.back() == b[ 0 ] && b.back() == c[ 0 ]){
		cout <<"YES";
	}else{
		cout << "NO";
	}
}
int main(){

	*/#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif*/

	int T = 1;
	while(T--){
		solve();
	}
	  	
	return 0;
}
