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())

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[len(a)-1]==b[0] and c[0]==b[len(b)-1] 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]:
    print('YES')
else:
    print('NO')

Solution (Python):
A,B,C=input().split()
if (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]:
  if B[-1] == C[0]:
    print("YES")
    quit()
    
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]:
    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[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[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

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

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

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

d, e, f, g = a[-1], b[0], b[-1], c[0]

y = d == e 
z = f == g 

if (y == True) and (z==True):
    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):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b, c = rs()
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 = 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 = 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[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[-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 = [str(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()
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

if A==B and B1==C:
    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=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):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, c = M()
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):
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 = 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):

lst = input().split()

A = lst[0]
B = lst[1]
C = lst[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())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
a = [str(i) for i in input().split()]
if a[0][-1] == a[1][0] and a[1][-1] == a[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,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('YNEOS'[a[-1]+c[0]!=b[0]+b[-1]::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):
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

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

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

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()

A_e = A[-1]
B_f = B[0]
B_e = B[-1]
C_f = C[0]

if (A_e == B_f) and (B_e == C_f):
    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 main():
    a, b, c = input().split()

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

if __name__ == "__main__":
    main()

Solution (Python):
def actual(A, B, C):
    if A[-1] == B[0] and B[-1] == C[0]:
        return 'YES'

    return 'NO'

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

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):
def main():
    A, B, C = input().split(' ')
    if A[-1] == B[0] and B[-1] == C[0]:
        print('YES')
    else:
        print('NO')
main()

Solution (Python):
import sys
str_array = list(map(str,input().split()))

for I in str_array:
    if not I.islower():
        sys.exit()
    if len(I) < 0 or len(I) > 10:
        sys.exit()

result = "YES"
last = ""
first = ""
for J in range(len(str_array)-1):
    first = str_array[J+1][0]
    last = str_array[J][-1]
    if not last == first:
        result = "NO"

print(result)

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();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 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(['NO','YES'][a[-1]==b[0] and b[-1]==c[0]])

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 = 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] 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[len(A)-1] == B[0] and B[len(B)-1] == C[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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()
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('NYOE S'[a[-1]==b[0] and b[-1]==c[0]::2])

Solution (Python):
a=input()

b=a.split(' ')

if b[0][-1]==b[1][0] and b[1][-1]==b[2][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()

x = a[-1]
y = b[0]
z = b[-1]
w = c[0]

if x == y and z == w:
  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):
s1, s2, s3 = input().split()
if (s1[-1] == s2[0]) and (s2[-1] == s3[0]):
  print('YES')
else:
  print('NO')

Solution (Python):
a,b,c = input().split()
sa = len(a)
sb = len(b)
ok = True
if a[sa-1] != b[0]: ok = False
if b[sb-1] != c[0]: ok = False
if ok: 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 = 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 = 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()

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

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

Solution (Python):
sl = input().split()
print('YES' if sl[0][-1] == sl[1][0] and sl[1][-1] == sl[2][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=map(str,input().split())

a=len(A)
b=len(B)

if A[a-1]==B[0] and B[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 = 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()
result = 'NO'
if a[-1] == b[0]:
    if b[-1] == c[0]:
        result = 'YES'
print(result)

Solution (Python):
A, B, C = list(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):
s = input().strip().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()
if (A[-1]==B[0]) and (B[-1]==C[0]):
  print('YES')
else:
  print('NO')

Solution (Python):
a,b,c = input().split()
al = len(a)
bl = len(b)
if a[al-1] == b[0] and b[bl-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()
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()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "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=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()

la = list(a)
lb = list(b)
lc = list(c)


if la[-1] == lb[0] and lb[-1] == lc[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 = map(list,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]:
        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 = 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().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):
n = input().split()
a = n[0]
b = n[1]
c = n[2]
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):
s1, s2, s3 = input().split()
print('YES' if s1[-1] == s2[0] and s2[-1] == s3[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()
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[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]==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 print('NO')

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, c = read().decode().split()
ans = 'YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO'
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):
x = list(input().split())
if x[0][-1] == x[1][0] and x[1][-1] == x[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):
def main():
  num = list(map(str,input().split()))
  if num[0][-1]==num[1][0] and num[1][-1]==num[2][0]:
    print('YES')
  else:
    print('NO')
main()

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):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a,b,c=input().split()
    YESNO(a[-1]==b[0] and b[-1]==c[0])

if __name__ == '__main__':
    main()

Solution (Python):

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

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

print("NO")

Solution (Python):
A,B,C = map(str,input().split())
if (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("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]:
    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 = map(str, 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()
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):
sa, sb, sc = input().split()
print("YES" if sa[-1] == sb[0] and sb[-1] == sc[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):
s1,s2,s3=map(str,input().split())
if s1[len(s1)-1]==s2[0] and s2[len(s2)-1]==s3[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())
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 = 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):

"""
Created on Thu May 14 16:12:00 2020

@author: shinba
"""


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("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 = 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 = map(str, input().split())

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

Solution (Python):






import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


def lcm(a, b):
    return a * b // gcd (a, b)





s = inputSL()

if s[0][-1] == s[1][0] and s[1][-1]==s[2][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]:
        ans = 'YES'
    else:
        ans = 'NO'
    print(ans)


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):
import sys
import math
import bisect

def main():
    a, b, c = input().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 = map(str,input().split())

flag = True
if A[-1] != B[0]:
    flag = False

if B[-1] != C[0]:
    flag = False

if flag:
    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 = 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())

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

Solution (Python):
lis = input().split()
lis_a = lis[0][len(lis[0])-1]
lis_bt = lis[1][0]
lis_bf = lis[1][len(lis[1])-1]
lis_c = lis[2][0]

if lis_a == lis_bt and lis_bf == lis_c:
  print("YES")
else:
  print("NO")

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C = rs_()
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):
x = input()
ls_x = x.split()

a = ls_x[0]
b = ls_x[1]
c = ls_x[2]


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):
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 ABC_60_A():
    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')

if __name__ == '__main__':

    ABC_60_A()

Solution (Python):
list = [i for i in input().split(" ")]
loop = 0
char = list[0][0]
for i in list:
    if char == i[0]:
        char = i[len(list[loop]) - 1]
        loop = loop + 1
    else:
        print("NO")
        exit()
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):
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):
def main():
    a,b,c = (input().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('YES' if a[-1:] == b[0:1] and b[-1:] == c[0:1] 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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = LIST()


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

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')