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=input().split()
print("YES" if a[-1] == b[:1] and b[-1] == c[: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):
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 = [str for str in 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()]
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):
a, b, c = [i for i in 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());print(["NO","YES"][A[-1]is B[0] and B[-1]is C[0]])

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

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

if s[0][len(s[0])-1] ==s[1][0] and s[1][len(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):
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()
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=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):
def shiritori(a, b, c):
	if a[-1] == b[0] and b[-1] == c[0]: return 'YES'
	else: return 'NO'

a, b, c = raw_input().split()
print shiritori(a, b, c)

Solution (Python):
ina,inb,inc = input().split()
if ina[-1] == inb[0] and inb[-1] == inc[0]:
  print("YES")
else:
  print("NO")

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

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

if N[0][-1]==N[1][0] and N[1][-1]==N[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 = list(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 = 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 = 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()
A=len(a)
B=len(b)
if a[(A-1)]==b[0]:
    if b[(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):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

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


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

Solution (Python):





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

Solution (Python):
a,b,c=input().split()
s=[a,b,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()
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):


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()
alen = len(a)
blen = len(b)
clen = len(c)
if a[alen-1] == b[0] and b[blen-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] 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 = raw_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().strip().split()]
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

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

Solution (Python):

"""
https://abc060.contest.atcoder.jp/tasks/abc060_a

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B, C):
    ans = 'NO'
    if A[-1] == B[0] and B[-1] == C[0]:
        ans = 'YES'
    return ans


def main(args):
    A, B, C = input().strip().split()
    ans = solve(A, B, C)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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):
l = map(str, raw_input().split())
for i in range(len(l)-1):
    tempa = list(l[i])
    tempb = list(l[i+1])
    if tempa[len(tempa)-1] != tempb[0]:
        print "NO"
        exit(0)
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()
print("YES") if a[-1]==b[0] and b[-1]==c[0] 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):
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=raw_input().split()
print "YES" if A[-1]==B[0] and B[-1]==C[0] else "NO"

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

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

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

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


solve()

Solution (Python):
n = raw_input().split()
print 'YES' if n[0][-1] == n[1][0] and n[1][-1] == n[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 = 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[-1]==B[0] and B[-1]==C[0]):
    print("YES")
else:
    print("NO")

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

if val[0][len(val[0])-1] == val[1][0] and val[1][len(val[1])-1] == val[2][0]:
    print("YES")
else:
    print("NO")

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):
A,B,C = map(str,input().split())
lst1 = list(A)
lst2 = list(B)
lst3 = list(C)
if lst1[-1] ==lst2[0] and lst2[-1] == lst3[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):
ls = input().split()

if ls[0][-1:] == ls[1][0] and ls[1][-1:] == ls[2][0]:
    print("YES")
else:
    print("NO")

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

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

Solution (Python):

s,y,j=input().split()

ss=len(s)
yy=len(y)
jj=len(j)
nyan=0
if s[ss-1:ss]==y[0:1]:
    nyan+=1
    
if y[yy-1:yy]==j[0:1]:
    nyan+=1
    
    
if nyan==2:
    print('YES')
else:
    print('NO')

Solution (Python):
A, B, C = raw_input().split()
print "YES" if A[-1] == B[0] and B[-1] == C[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[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, raw_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 = [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()


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

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):
def read_str_list():
    return list(str(s) for s in input().split())

a,b,c = read_str_list()
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=map(str,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()]
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]: print("YES")
    else: print("NO")


if __name__ == "__main__":
    main()

Solution (Python):
A,B,C=[i for i in 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")
else:
    print("NO")

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

X = False
if A[-1]==B[0]:
    if B[-1] == C[0]:
        X = True

if X:
    print('YES')
else:
    print('NO')

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

Solution (Python):



import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



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

if __name__ == "__main__": main()

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

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

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

Solution (Python):
from collections import defaultdict


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


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

    elif b[-1] != c[0]:
        print("NO")

elif a[-1] != b[0]:
    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):
if __name__ == "__main__":
    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):
l = list(map(str, input().split()))


if (l[0][-1] == l[1][0]) and (l[1][-1] == l[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):
s = input().split()
ans = "YES"
a = s[0][-1]
for i in s[1:]:
    if i[0] != a:
        ans = "NO"
    else:
        a = i[-1]
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())
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 = raw_input().split()
print 'YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO'

Solution (Python):
arr=input().split()
if arr[0][-1] == arr[1][0] and arr[1][-1] == arr[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):
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()

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):
mo=input()
list=mo.split()
a=str(list[0])
b=str(list[1])
c=str(list[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,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,raw_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_arr = list(a)
a_tail = a_arr[-1]

b_arr = list(b)
b_head = b_arr[0]
b_tail = b_arr[-1]

c_arr = list(c)
c_head = c_arr[0]

if a_tail == b_head:
   if b_tail == c_head:
      print("YES")
   else:
      print("NO")
else:
   print("NO")

Solution (Python):
A,B,C=raw_input().split()
print "YES" if A[-1:]==B[:1] and B[-1:]==C[:1] else "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=map(str,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] is b[0]) and (b[-1] is 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):
def solve():
    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__":
    solve()

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

result = True
for i in range(len(input_list) - 1):
    result = result and (input_list[i][-1] == input_list[i+1][0])

if result:
    print("YES")
else:
    print("NO")

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

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

Solution (Python):
def solve():
  ar = raw_input().split(' ')
  A = ar[0]
  B = ar[1]
  C = ar[2]
  if A[-1] == B[0] and B[-1] == C[0] : return 'YES'
  else: return 'NO'

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

Solution (Python):
from sys import stdin
a,b,c = stdin.readline().strip().split()
ans = 'NO'
if a[-1]==b[0] and b[-1]==c[0]:
 ans = 'YES'
print ans

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

    print(ans)

if __name__ == '__main__':
   solve()

Solution (Python):
l = input().split(' ')

def shiritori(_l):
    for s,t in zip(_l[:-1], _l[1:]):
        if not s[-1]==t[0]:
            return 'NO'
    else:
        return 'YES'
    
print(shiritori(l))

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

shiritori = "YES"

end = None

for word in words:
	if end is not None:
		if end != word[0]:
			shiritori = "NO"
			break
	end = word[-1]

print(shiritori)

Solution (Python):
import sys

a, b, c = [str(x) for x in sys.stdin.readline().split()]

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

Solution (Python):
import sys

a, b, c = [str(x) for x in sys.stdin.readline().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):
n = input()
tmp_n = n.split(" ")

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

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

Solution (Python):
A, B, C = raw_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):
string = raw_input().split()
if string[0][-1] == string[1][0] and string[1][-1] == string[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):

def shiritori(a, b):
    return a[len(a)-1:] == b[:1]


a, b, c = input().split()
if shiritori(a, b) is True and shiritori(b, c) is True:
    print("YES")
else:
    print("NO")

Solution (Python):

a, b, c = map(str, raw_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=raw_input().split()

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

Solution (Python):

input_string = input()
s1, s2, s3 = input_string.split()

if (s1[-1] == s2[0]) and (s2[-1] == s3[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\n")
else:
    print("NO\n")

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

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

Solution (Python):
str1,str2,str3=input().split()
if str1[-1:]==str2[:1] and str2[-1:]==str3[:1]:
    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):
s = input().split()
A = s[0]
B = s[1]
C = 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 = map(str, raw_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 siritori(a):
    s1 = a[0]
    s2 = a[1]
    s3 = a[2]
    if s1[-1]==s2[0] and s2[-1]==s3[0]:
        print("YES")
    else:
        print("NO")

siritori(input().split(" "))

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

Solution (Python):
a=map(str, raw_input().split())

a_0=list(a[0])
a_1=list(a[1])
a_2=list(a[2])

if a_0[-1]==a_1[0] and a_1[-1]==a_2[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):
s = input().split()
print("YES" if s[0][-1] == s[1][0] and s[1][-1] == s[2][0] else "NO")

Solution (Python):

array = input().split(" ")
flag = True
for i,s in enumerate(array[:(len(array)-1)]):
    if s[-1] != array[i+1][0]:
        flag = False
if flag is True:
    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()
ans='NO'
if A[-1]==B[0] and B[-1]==C[0]:
  ans='YES'
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):
S = input()
S = S.split(" ")

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

Solution (Python):
S = input()
S = S.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[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):
def main():
    A, B, C = map(str, input().split())

    if A[-1] == B[0] and B[-1] == C[0]:
        print('YES')
    else:
        print('NO')
        
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 = 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 = raw_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=input().split();print('YES'*(a[-1]==b[0])*(b[-1]==c[0])or'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 = input().split()


saigo = []
for i in range(2):
    tmp = s[i][len(s[i]) - 1:]
    saigo.append(tmp)


if saigo[0] == s[1][0:1] and saigo[1] == s[2][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):
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(['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):
def main():
        s = input().split()

        if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
            print("YES")
        else:
            print("NO")
main()

Solution (Python):
word = list(input().split())
if word[0][-1] == word[1][0] and word[1][-1] == word[2][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 = raw_input().split()
flag    = True

if a[-1] != b[0] or b[-1] != c[0]:
	flag = False

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

Solution (Python):

A, B, C = raw_input().split()
a=A[-1]
b1=B[0]
b2=B[-1]
c=C[0]

if a==b1 and b2==c:
    print "YES"
else:
    print "NO"