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):
def iroha():
    a, b, c = input().split()
    
    s = a[len(a)-1]
    sshead = b[0]
    sstail = b[len(b)-1]
    sss = c[0]

    if s == sshead and sstail == sss:
        print("YES")
    else:
        print("NO")





if __name__ == "__main__":
    iroha()

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):
s = (input().split())
t = len(s)
cnt = 0
for i in range(t):
    if i != t - 1:
        if (s[i][-1]) == s[i + 1][0]:
            cnt += 1
    else:
        break

if cnt == t - 1: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[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[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):
s1,s2,s3 = input().split()
print("YES") if s1[-1]==s2[0] and s2[-1]==s3[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):
def atc_060a(input_value: str) -> str:
    A, B, C = map(str, input_value.split(" "))
    if A[-1] == B[0] and B[-1] == C[0]:
        return "YES"
    else:
        return "NO"

input_value = input()
print(atc_060a(input_value))

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

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

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

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

Solution (Python):

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

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

Solution (Python):
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 (1<=len(A) and len(A)<=10 and A.islower()) and (1<=len(B) and len(B)<=10 and B.islower())\
        and (1<=len(C) and len(C)<=10 and C.islower()):
    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()

def answer(A: int, B: int, C: int) -> str:
    if A[-1] == B[0] and B[-1] == C[0]:
        return 'YES'
    else:
        return 'NO'

print(answer(A, B, C))

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

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b, c = s_map()

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

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('YNEOS'[a[-1]!=b[0] or b[-1]!=c[0]::2])

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

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

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

Solution (Python):
'''
問題：
    文字列 A, B, Cが与えられます。
    これがしりとりになっているか判定してください。

    つまり、
        A の最後の文字と B の最初の文字が同じ
        B の最後の文字と C の最初の文字が同じ
    この 2つが正しいか判定してください。
    両方とも正しいならば YES、そうでないならば NO を出力してください。
'''

'''
制約：
    A, B, C は全て英小文字(a ~ z)からなる。
    1 ≦ |A|, |B|, |C| ≦ 10
    なお、
    |A|, |B|, |C| は文字列A, B, Cの長さを表します。
'''


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

result = 'ret'

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

print(result)

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 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 atc_060a(input_value: str) -> str:
    A, B, C = map(str, input_value.split(" "))
    if A[-1] == B[0] and B[-1] == C[0]:
        return "YES"
    else:
        return "NO"

input_value = input()
print(atc_060a(input_value))

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

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

print(result)

Solution (Python):

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

Solution (Python):



def f(x):
    f_list = []
    for i in x:
        f_list.append(i)
    return f_list



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

word_list_a = f(a)
word_list_b = f(b)
word_list_c = f(c)

if word_list_a.pop() == word_list_b[0] and word_list_b.pop() == word_list_c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):


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

initial_1 = A[-1]
end_1 = B[0]
initial_2 = B[-1]
end_2 = C[0]

if initial_1 == end_1 and initial_2 == end_2:
    print("YES")
else:
    print("NO")

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

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

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

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

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

Solution (Python):

A,B,C=input().split()
if 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]:
    result = 'YES'
else:
    result = 'NO'
print(result)

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

word_list = input().split()
w_cnt = len(word_list)


s_list = []
e_list = []
for cnt in range(0,w_cnt,1):
    s_list.append(word_list[cnt][0])
    e_list.append(word_list[cnt][-1])


judge = "YES"
for cnt in range(1,w_cnt,1):
    if s_list[cnt] != e_list[cnt-1]:
        judge = "NO"
print(judge)

Solution (Python):

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

if __name__ == "__main__":
    resolve()

Solution (Python):
A, B, C = 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, 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):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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 B.startswith(A[-1]) and C.startswith(B[-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()
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):
S_1, S_2, S_3 = map(str,input().split())
if S_1[-1] == S_2[0] and S_2[-1] == S_3[0] :
    result = "YES"
else :
    result = "NO"
print(result)

Solution (Python):
num_a, num_b, num_c = map(str, input().split())

if num_a[-1] == num_b[0] and num_b[-1] == num_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()
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 =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
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """rng gorilla apple"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """yakiniku unagi sushi"""
        output = """NO"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """a a a"""
        output = """YES"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """aaaaaaaaab aaaaaaaaaa aaaaaaaaab"""
        output = """NO"""
        self.assertIO(input, output)


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=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 = (s for s in 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())

flag = False
if a[-1] == b[0]:
    if b[-1] == c[0]:
        flag = True
        
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()
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();print('NYOE S'[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 = map(str,input().split())
if(a[-1]==b[0] and b[-1]==c[0]):
    print('YES')
else:
    print('NO')

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

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

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


if __name__ == "__main__":
    solve()

Solution (Python):
A,B,C=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[-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):
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):
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()

d = len(a)-1
e = len(b)-1

if a[d] == b[0] and b[e] == 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
def input(): return sys.stdin.readline().strip()

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())
isOK = False
if a[-1]==b[0] and b[-1]==c[0]:
    isOK = True

if isOK:
    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()
f = lambda x, y, z : x[-1] == y[0] and y[-1] == z[0]
print("YES" if f(a, b, c) else "NO")

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

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

Solution (Python):
a,b,c=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):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(str, readline().decode('utf-8').strip().split())
    if A[-1]==B[0] and B[-1]==C[0]:
        print('YES')
    else:
        print('NO')



if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

print(ans)

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

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

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

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

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

Solution (Python):
X, Y, Z = input().split()
if X[-1]==Y[0] and Y[-1]==Z[0]:
  print('YES')
else:
  print('NO')

Solution (Python):

import sys
data = list(i for i in input().split())

for i in range(len(data)-1):
    if (data[i][-1] == data[i + 1][0]):
        continue
    else:
        print("NO")
        sys.exit()
else:
    print("YES")

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

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

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

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

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 sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
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 = input().split()
n = 0
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print('YES')
else:
    print('NO')

Solution (Python):
tmp = input().split(" ")
a_end = tmp[0][-1:]
b_start = tmp[1][:1]
b_end = tmp[1][-1:]
c_start = tmp[2][:1]

print("YES") if (a_end == b_start and b_end == c_start) 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 = list(map(str,input().split()))
flag = 0

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

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

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

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

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

Solution (Python):
a, b, c = 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):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

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

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()
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]:
    if B[-1] == C[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

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

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

Solution (Python):
A = list(map(str,input().rstrip().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()
flg = a[-1] == b[0] and b[-1] == c[0]
print("YES" if flg 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())
Flag = 1
if a[len(a)-1]!=b[0]:
  Flag =0
if b[len(b)-1]!=c[0]:
  Flag =0
if Flag == 0:
  print("NO")
else:
  print("YES")