#abc060a. [abc060_a]Shiritori

[abc060_a]Shiritori

Problem Statement

You are given three strings AA, BB and CC. Check whether they form a word chain.

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

  • The last character in AA and the initial character in BB are the same.
  • The last character in BB and the initial character in CC are the same.

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

Constraints

  • AA, BB and CC are all composed of lowercase English letters (a - z).
  • 1A,B,C101 ≤ |A|, |B|, |C| ≤ 10, where A|A|, B|B| and C|C| are the lengths of AA, BB and CC, respectively.

Input

Input is given from Standard Input in the following format:

AA BB CC

Output

Print YES or NO.


Sample Input 1

rng gorilla apple

Sample Output 1

YES

They form a word chain.


Sample Input 2

yakiniku unagi sushi

Sample Output 2

NO

AA and BB form a word chain, but BB and CC do not.


Sample Input 3

a a a

Sample Output 3

YES

Sample Input 4

aaaaaaaaab aaaaaaaaaa aaaaaaaaab

Sample Output 4

NO