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

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 = 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().rstrip().split()

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

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

print('YES' if a[a_len-1]==b[0] and b[b_len-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()
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()
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][0]==B[0] and B[::-1][0]==C[0]:
    print('YES')
else:
    print('NO')

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

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

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())
count = 0
if a[-1] == b[0]:
    count += 1
if b[-1] == c[0]:
    count += 1
if count ==2:
    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 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()

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 = 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())
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[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):
A,B,C=map(str,input().split())
print('YES'if A[int(len(A))-1]==B[0] and B[int(len(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[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 = 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()
a=str(A)
b=str(B)
c=str(C)
if a[-1]==b[0]:
    if 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):
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 = list(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(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]])

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

if A[-1] == B[0] and B[-1] == C[0]:
  Answer = 'YES'

print(Answer)

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()
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):
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):
def abc(a,b,c):
    
    return "YES" if a[-1] == b[0] and b[-1] == c[0] else "NO"
 
def main():
    a , b , c = map(str, input().split())
    print(abc(a , b , c))
 
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 = input().split()
if a[-1]==b[0] and b[-1]==c[0]:
         print("YES")
else:
    print("NO")

Solution (Python):
a = input()
list_a = a.split(" ")
b = [] 
for i in range(len(list_a)):
    b.append(list(list_a[i]))
if b[0][-1] == b[1][0] and b[1][-1] == b[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 = 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[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):
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):




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


if __name__ == "__main__":
    main()

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 = 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=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 = map(str,input().split())
ans = 'YES'
if a[-1] != b[0]:
    ans = 'NO'
if b[-1] != c[0]:
    ans = 'NO'
print(ans)

Solution (Python):
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C = readline().decode('utf8').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())
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]:
    if B[len(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()
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):
list = input().split()
if list[0][-1] == list[1][0] and list[1][-1] == list[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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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=[]
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 = 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):
def main():
    from sys import stdin, setrecursionlimit
    
    
    r = stdin.readline()[:-1]
    
    
    
    
    a, b, c = r.split()
    
    
    
    
    

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

if __name__ == '__main__':
    main()

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 = input().split()

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

Solution (Python):
a=list(str(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()
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):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    ss=input().split()
    if ss[0][-1]==ss[1][0] and ss[1][-1]==ss[2][0]:print("YES")
    else:print("NO")
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 = 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(format, 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):
import sys
input = sys.stdin.readline
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 = 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 = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):


import numpy as np
import math

a=input().split()
for i in range(len(a)-1):
    if(a[i][len(a[i])-1]!=a[i+1][0]):
        print("NO")
        exit(0)
print("YES")

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

if(a.endswith(b[0]) and b.endswith(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):
sArray = list(input().split())

if sArray[0][-1] == sArray[1][0] and sArray[1][-1] == sArray[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 = 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 = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Solution (Python):
s1, s2, s3 = (i for i in input().split())

if s1[-1] == s2[0] and 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=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):
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
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):
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Solution (Python):
word = 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=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] 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 = 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, 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):
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): 
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

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

def divisors(a): 
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): 
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): 
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): 
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

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

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()
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[-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]:
    ans = 'YES'
else:
    ans = 'NO'

print(ans)

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 s[0][-1]==s[1][0] and s[1][-1]==s[2][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 = list(input().split())
ans = 'YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO'
print(ans)

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[-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 = map(str,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):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

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

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

Solution (Python):
import math

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

Solution (Python):
import sys

a, b, c = sys.stdin.readline().split()

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

if __name__ == '__main__':
    ans = main()
    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):
import sys

a,b,c = map(str, 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 = 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):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

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

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

Solution (Python):
A,B,C = list(map(str,input().split()))
ans="NO"
if A[len(A)-1] == B[0] and B[len(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):
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=list(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):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

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


if __name__ == "__main__":
    solve()

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())
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 = input().split()
check = a[-1] == b[0] and b[-1] == c[0]
print('YES' if check 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 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();print(" YNEOS"[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 = input().split()

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

if (d == e)and(f==g):
    print ("YES")
else:
    print ("NO")

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

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

print(res)

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)

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

Solution (Python):
from sys import stdin

a,b,c = [x for x in stdin.readline().rstrip().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 = 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]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

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

ok = True
for i in range(1,len(a)):
  if a[i-1][-1]==a[i][0]:
    continue
  else:
    ok = False
print("YES" if ok else "NO")