Problem:
 Score : 100 points    Problem Statement 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 .        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  A and B form a word chain, but B and C do not.       Sample Input 3 a a a      Sample Output 3 YES       Sample Input 4 aaaaaaaaab aaaaaaaaaa aaaaaaaaab      Sample Output 4 NO

Solution (Python):
A,B,C = map(str, input().split())

A_last = (A[-1])
B_first = (B[0]) 
B_last = (B[-1])
C_first = (C[0])

if A_last == B_first and B_last == C_first:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a,b,c= input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a,b,c=input().split()
print("YES" if (a[-1]==b[0] and b[-1]==c[0]) else "NO")

Solution (Python):
a,b,c = map(str,input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
A,B,C = map(list,input().split())

print('YES') if A[-1] == B[0] and B[-1] == C[0] else print('NO')

Solution (Python):
a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0]:
    if b[-1] == c[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Solution (Python):
A, B, C = input().split()
if A[len(A)-1]==B[0] and B[len(B)-1]==C[0]:
    print('YES')
    exit()
print('NO')

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7


A,B,C = input().split()

print("YES" if A[-1]==B[0] and B[-1]==C[0] else "NO")

Solution (Python):

import math


A, B, C = map(str, input().split())

if (len(A) == 1) :
  Aend = A
else :
  Aend = A[len(A)-1:len(A)]

if (len(B) == 1) :
  Bstart = B
  Bend = B
else :
  Bstart = B[0:1]
  Bend = B[len(B)-1:len(B)]

Cstart = C[0:1]

if Aend == Bstart and Bend == Cstart :
  print ("YES")
else :
  print ("NO")

Solution (Python):
A, B, C = input().split()
print("YES" if A[-1]==B[0] and B[-1]==C[0] else "NO")

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=map(str, input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else("NO"))

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a, b, c = input().split()
if (a[-1] == b[0]) and (b[-1] == c[0]) :
    print("YES")
else :
    print("NO")

Solution (Python):
A,B,C = input().split()
print('YES' if A[-1]==B[0] and B[-1]==C[0]  else 'NO')

Solution (Python):
def examA():
    A, B, C = LS()
    if A[-1]==B[0] and B[-1]==C[0]:
        ans = "YES"
    else:
        ans = "NO"
    print(ans)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Solution (Python):
a,b,c = input().split()

if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
	print('YES')
else:
	print('NO')

Solution (Python):
a,b,c=map(str, input().split()) 
if a[len(a)-1:len(a)] == b[0:1] and b[len(b)-1:len(b)] == c[0:1]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
S = input().split()

if S[0][len(S[0])-1] != S[1][0] or S[1][len(S[1])-1] != S[2][0]:
    print("NO")
else:
    print("YES")

Solution (Python):
a,b,c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0]:print("YES")
else:print("NO")

Solution (Python):
A , B , C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")

else:
    print("NO")

Solution (Python):
A, B, C = map(str, input().split())
a = list(A)
b = list(B)
c = list(C)
 
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
a, b, c = map(str,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
	print ("YES")
else:
	print ("NO")

Solution (Python):
A,B,C=map(str,input().split())
print('YES' if A[-1]==B[0] and B[-1]==C[0] else'NO')

Solution (Python):
a,b,c=input().split()
n=len(a)
m=len(b)
if a[n-1]==b[0] and b[m-1]==c[0]:print('YES')
else:print('NO')

Solution (Python):
a,b,c=map(str,input().split())
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()
if a[-1]==b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):

A, B, C = input().split()
if A[-1:] == B[:1]:
    if B[-1:] == C[:1]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Solution (Python):
a,b,c=map(str,input().split())
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
a, b, c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=map(str,input().split())
aa=list(a)
bb=list(b)
cc=list(c)
if aa[-1]==bb[0] and bb[-1]==cc[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=input().split()
a=list(a)
b=list(b)
c=list(c)
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
x, y, z = [i for i in input().split()]
if x[-1] != y[0]:
     print('NO')
elif y[-1] != z[0]:
    print('NO')
else: 
    print ('YES')

Solution (Python):

a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    ans = "YES"
else:
    ans = "NO"
print(ans)

Solution (Python):

A, B, C = input().split()
if(A[-1] == B[0] and B[-1] == C[0]):
  print('YES')
else:
  print('NO')

Solution (Python):
A,B,C = map(str, input().split())
print('YNEOS'[not(A[-1]==B[0] and B[-1]==C[0])::2])

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print('YES')
else:print('NO')

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C = input().split()
if A[-1]== B[0] and B[-1]==C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C = (x for x in input().split())

list_A = list(A)
list_B = list(B)
list_C = list(C)

if list_A[len(list_A)-1] == list_B[0] and list_B[len(list_B)-1] == list_C[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
A,B,C=input().split()
f=A[-1]==B[0] and B[-1]==C[0]
print('YES' if f else 'NO')

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a, b, c = map(str, input().split())
print('YES'if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0]:
    if b[-1]==c[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Solution (Python):




a,b,c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
A,B,C = map(str,input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = list(input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c= map(str ,input().split())
if a[-1:]==b[0] and b[-1:]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()

if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=map(str,input().split())
o=a[-1:];p=b[0];q=b[-1:];r=c[0]
if o == p and q == r:
  print('YES')
else:
  print('NO')

Solution (Python):
A,B,C = input().strip().split()
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
A,B,C = input().split()

A = A[len(A)-1:len(A)]
Bf = B
Bl = B
Bf = Bf[0:1]
Bl = Bl[len(B)-1:len(B)]
C = C[0:1]

if A == Bf:
    if Bl == C:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Solution (Python):
x,y,z=input().split()
lx=len(x)
ly=len(y)
lz=len(z)
if x[lx-1]==y[0]:
    if y[ly-1]==z[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Solution (Python):
x,y,z=input().split()
lx=len(x)
ly=len(y)
lz=len(z)
if x[lx-1]==y[0]:
    if y[ly-1]==z[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Solution (Python):
a,b,c=(input().split())
alen=len(a)
blen=len(b)
clen=len(c)
if a[int(alen)-1]==b[0] and b[int(blen)-1]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
A, B, C = input().split(" ")

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
x = input().split()
a = x[0]
b = x[1]
c = x[2]

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
s = input().split()
if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a = list(map(str,input().split()))
A = a[0]
B = a[1]
C = a[2]

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = map(str, input().split())

a_last = a[len(a) - 1]
b_last = b[len(b) - 1]

if a_last == b[0] and b_last == c[0] :
    print('YES')
else :
    print('NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
if(a[-1]==b[0] and b[-1]==c[0]):
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
A = list(input().split())
print('YES' if A[0][-1]==A[1][0] and A[1][-1]==A[2][0] else 'NO')

Solution (Python):
a, b, c = input().split()
print(['NO', 'YES'][a[-1] == b[0] and b[-1] == c[0]])

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    ans = "YES"
else:
    ans = "NO"

print(ans)

Solution (Python):
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a,b,c=input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C=map(str,input().split());print('YNEOS'[A[-1]!=B[0] or B[-1]!=C[0]::2])

Solution (Python):
A, B, C = tuple(input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]: print("YES")
else: print("NO")

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c = list(map(str, str(input().rstrip('\n')).split()))
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == '__main__':
    slove()

Solution (Python):
A,B,C=list(input().split())
A=list(A)
B=list(B)
C=list(C)
if A[-1]==B[0] and B[-1]==C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c=map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = map(str, input().split())
an = len(a)
bn = len(b)

if a[an-1] == b[0]:
  if b[bn-1] == c[0]:
    print('YES')
    exit()
print('NO')

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    a, b, c = input().split()
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == "__main__":
    main()

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = input().split()
print('YES' if (a[-1] == b[0]) and (b[-1] == c[0]) else 'NO')

Solution (Python):
import sys
input = sys.stdin.readline

A,B,C = input().split()
A=list(A)
B=list(B)
C=list(C)

if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
  
else:
  print('NO')

Solution (Python):
A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
  
else:
  print('NO')

Solution (Python):
a,b,c = input().split()
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Solution (Python):

A, B, C = input().split()

if A[-1] == B[0]:
    if B[-1] == C[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()
if a[-1] != b[0]:
  print("NO")
elif b[-1] != c[0]:
  print("NO")
else:
  print("YES")

Solution (Python):


a,b,c = input().split()

lis_a = list(a)
lis_b = list(b)
lis_c = list(c)

isATrue = (lis_a[-1] == lis_b[0])
isBTrue = (lis_b[-1] == lis_c[0])

if isATrue and isBTrue:
    print("YES")
else:
    print("NO")

Solution (Python):
A, B, C = input().split()
print("YES" if (A[-1] == B[0] and B[-1] == C[0]) else "NO")

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=map(str,input().split())

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = [s for s in input().split()]
if a[-1:] == b[0] and b[-1:] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
def do():
    a,b,c=STRM()
    if a[-1]==b[0] and b[-1]==c[0]:
        print('YES')
    else:
        print('NO')
if __name__ == '__main__':
    do()

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
   print('YES')
else:
   print('NO')

Solution (Python):


a, b, c = map(str, input().split())

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
l = input().split()
a = l[0][-1] == l[1][0]
b = l[1][-1] == l[2][0]
flag = a and b
if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
a,b,c = map(str,input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
a, b, c = input().rstrip().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
ABC = list(map(list,input().split()))
for i in range(2):
    if ABC[i][-1] != ABC[i+1][0]:
        print("NO")
        break
    if i == 1:
        print("YES")

Solution (Python):
a, b, c = input().split()
if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
def main():
    a,b,c=input().split(' ')
    if a[-1] == b[0] and b[-1] == c[0]:
        print('yes'.upper())
    else:
        print('no'.upper())

if __name__ == '__main__':
    main()

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C = map(str, input().split())

if (A[-1]==B[0]) and (B[-1]==C[0]):
  print('YES')
else:
  print('NO')

Solution (Python):
A, B, C= input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
def resolve():
    a, b, c = input().split()
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == "__main__":
    resolve()

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

s1,s2,s3=map(str,input().split())

if s1[-1]==s2[0] and s2[-1]==s3[0]:
	print("YES")
else:
	print("NO")

Solution (Python):
A,B,C = input().split()

if A[len(A)-1]==B[0] and B[len(B)-1]==C[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
s=list(input().split())
a=list(s[0])
b=list(s[1])
c=list(s[2])
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = map(str, input().split())
if a[-1]==b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a, b, c = list(input().split(' '))
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = list(input().split())

if ((A[-1] == B[0]) and (B[-1] == C[0])):
    print("YES")
else:
    print("NO")

Solution (Python):
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = input().split()
print("YES" if A[-1] == B[0] and B[-1] == C[0] else "NO")

Solution (Python):
A,B,C = input().split()
if A[-1]==B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
A,B,C=input().split();print("YNEOS"[A[-1]!=B[0]or B[-1]!=C[0]::2])

Solution (Python):
A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
    print('YES')
else :
    print('NO')

Solution (Python):



a,b,c = map(str,input().split())

if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]])

Solution (Python):
A, B, C = map(str, input().split())
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    A, B, C = input().strip().split()

    if A[-1] == B[0] and B[-1] == C[0]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()

Solution (Python):
a,b,c=input().split();print('YNEOS'[a[-1]!=b[0] or b[-1]!=c[0]::2])

Solution (Python):
a, b, c = map(str, input().split())

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Solution (Python):
A,B,C = map(str, input().split())

if (A[-1] == B[0]) and (B[-1] == C[0]):
  print("YES")
else:
  print("NO")

Solution (Python):
A,B,C = map(str,input().split())
print('YES') if A[len(A)-1] == B[0] and B[len(B)-1] == C[0] else print('NO')

Solution (Python):
strings = list(input().split())

flag = 'YES'
for i in range(2):
    if strings[i][-1] != strings[i+1][0]:
        flag = 'NO'
print(flag)

Solution (Python):
A,B,C = map(list, input().split())
print('YES' if A[len(A)-1]==B[0] and B[len(B)-1]==C[0] else 'NO')

Solution (Python):
a, b ,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else :
  print("NO")

Solution (Python):

a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()
if all((a[-1] == b[0], b[-1] == c[0])):
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=map(str,input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = input().split()
print('YNEOS'[not(a[-1] == b[0] and b[-1]==c[0])::2])

Solution (Python):
s = input().split()
a, b, c = s[0], s[1], s[2]
if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = map(str, input().split())
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a,b,c=input().split()

if a[-1:]==b[0] and b[-1:]==c[0]:
    print("YES")

else:
    print("NO")

Solution (Python):
a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
a,b,c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
s = [i for i in input().split()]
print('YES' if s[0][-1]==s[1][0] and s[1][-1]==s[2][0] else 'NO')

Solution (Python):
a,b,c=input().split()
ans='NO'
if a[-1]==b[0]:
  if b[-1]==c[0]:
    ans='YES'
print(ans)

Solution (Python):
a,b,c = (str(i) for i in input().split())

A = list(a)
B = list(b)
C = list(c)

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
	print("YES")
else: print("NO")

Solution (Python):
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = input().split()
print("YES") if A[-1] == B[0] and B[-1] == C[0] else print("NO")

Solution (Python):
A,B,C = input().split()

if(A[-1]==B[0] and B[-1]== C[0]):
    print('YES')
else:
    print('NO')

Solution (Python):
a,b,c = input().split()

if a[-1:] == b[:1] and b[-1:] == c[:1]:
  print('YES')
else:
  print('NO')

Solution (Python):
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=map(str,input().split())
if a[-1]!=b[0]:
    print('NO')
else:
    if b[-1]!=c[0]:
        print('NO')
    else:
        print('YES')

Solution (Python):
a,b,c = input().split()
if(a[-1] == b[0] and b[-1] == c[0]):
  print("YES")
else:
  print("NO")

Solution (Python):


def resolve():
    a, b, c = input().split()
    if a[-1] == b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    resolve()

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
A = list(map(str,input().split()))
if A[0][(len(A[0]))-1] == A[1][0] and A[1][(len(A[1]))-1] == A[2][0]:
  print("YES")
else:
  print("NO")

Solution (Python):
A, B, C = input().split()

if A[-1]==B[0] and B[-1]==C[0]:print('YES')
else:print('NO')

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
A,B,C = map(str,input().split())
judge = True
if A[-1] != B[0]:
    judge = False
if B[-1] != C[0]:
    judge = False
if judge:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = map(str,input().split())
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]: print('YES')
else: print('NO')

Solution (Python):
S = input().split()
if S[0][-1] == S[1][0] and S[1][-1] == S[2][0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
def main():
    A, B, C = input().split()
    if A[-1] == B[0] and B[-1] == C[0]:
        return "YES"
    return "NO"


if __name__ == '__main__':
    print(main())

Solution (Python):
a,b,c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
s = input().split()
print('YES' if all(s[i][-1] == s[i+1][0] for i in range(2)) else 'NO')

Solution (Python):
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a, b, c = map(str, input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a,b,c=input().split();print("YNEOS"[a[-1]!=b[0] or b[-1]!=c[0]::2])

Solution (Python):
a,b,c = map(str,input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
	print("YES")
else:
	print("NO")

Solution (Python):
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Solution (Python):
a,b,c=input().split()

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
A,B,C = input().strip().split(' ')
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Solution (Python):
a,b,c = input().split(' ')

if ( a[-1] == b[0] and b[-1] == c[0] ):
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c=input().split()
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
  print("YES")
else:
  print("NO")

Solution (Python):
a,b,c = [i for i in input().split()]

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Solution (Python):
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
words = list(input().split())


for i in range(len(words)-1):
	if words[i][-1] == words[i+1][0]:
		ans = 'YES'
	else:
		ans = 'NO'
		break
		
print(ans)

Solution (Python):
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
a,b,c = map(str,input().split())

if (a[len(a)-1] == b[0]) and (b[len(b)-1] == c[0]):
    print("YES")
else:
    print("NO")

Solution (Python):
words = [s for s in input().split()]
if (words[0][-1]==words[1][0]) and (words[1][-1] == words[2][0]):
  print("YES")
else:
  print("NO")

Solution (Python):
A, B, C = input().split()
print("YES" if A[-1] == B[0] and B[-1] == C[0] else "NO")

Solution (Python):
a,b,c=map(str,input().split())

if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Solution (Python):
a, b, c = (i for i in input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")