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`.
A, B, C = input().split()
print(['No', 'Yes'][A[-1] == B[0] and B[-1] == C[0]])
A, B, C = input().split()
print(['NO', 'YES'][A[-1] == B[0] and B[-1] == C[0]])