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



Sample input:
rng gorilla apple


Sample output:
YES

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
a,b,c = LS()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")
#B

#C
""""
n,T = LI()
ans = 0
t = LI()
for i in range(n-1):
    ans += min(T,t[i+1]-t[i])
ans += T
print(ans)
"""

#D
"""
n,w = LI()
g = LIR(n)
l = [[] for i in range(4)]
for W,v in g:
    l[W-g[0][0]].append(v)
    l[W-g[0][0]].sort(reverse = True)
l0 = len(l[0])
l1 = len(l[1])
l2 = len(l[2])
l3 = len(l[3])
for i in range(l0-1):
    l[0][i+1] += l[0][i]
l[0].insert(0,0)
for i in range(l1-1):
    l[1][i+1] += l[1][i]
l[1].insert(0,0)
for i in range(l2-1):
    l[2][i+1] += l[2][i]
l[2].insert(0,0)
for i in range(l3-1):
    l[3][i+1] += l[3][i]
l[3].insert(0,0)
ans = 0
for i in range(l0+1):
    for j in range(l1+1):
        for k in range(l2+1):
            for m in range(l3+1):
                if i*g[0][0]+j*(g[0][0]+1)+k*(g[0][0]+2)+m*(g[0][0]+3) <= w:
                    ans = max(ans,l[0][i]+l[1][j]+l[2][k]+l[3][m])
print(ans)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
def shiritori(A: str, B: str, C: str) -> bool:
    return A[-1] == B[0] and B[-1] == C[0]


if __name__ == "__main__":
    A, B, C = input().split()
    yes = shiritori(A, B, C)
    print('YES' if yes else 'NO')

Submission status: Accepted

Solution code:
x,y,z=map(str,input().split(' '))

if x[len(x)-1]==y[0] and y[len(y)-1]==z[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b, c = input().split()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input().split();print('YNEOS'[s[0][-1]!=s[1][0]or s[1][-1]!=s[2][0]::2])

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A, B, C = input().split()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
As=[[j for j in i] for i in input().split()]
if As[0][-1] == As[1][0] and As[1][-1] == As[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#60
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func():
    A, B, C = input().split()
    result = 'YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO'
    return result

print(func())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
s = [elm[0] for elm in x.split()[1:]]
e = [elm[-1] for elm in x.split()[:-1]]
if s == e:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# abc060_a
"""
Shiritori
"""

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

def main():
	a, b, c = input().split(" ")
	aa = list(a)
	bb = list(b)
	cc = list(c)
	
	if aa[len(aa)-1] == bb[0] and bb[len(bb)-1] == cc[0]:
		print("YES")
	else:
		print("NO")
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
a, b, c = stdin.readline().rstrip().split()
if list(a)[-1] == list(b)[0] and list(b)[-1] == list(c)[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()
A = list(s[0])
B = list(s[1])
C = list(s[2])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = list(input().split())
for i in range(len(L)-1):
    if L[i][-1]  != L[i+1][0]:
        print("NO")
        break
else:
  print("YES")

Submission status: Accepted

Solution code:
L = list(input().split())
val = 0
for i in range(len(L)-1):
    if L[i][-1]  != L[i+1][0]:
        print("NO")
        break
else:
  print("YES")

Submission status: Accepted

Solution code:
L = list(input().split())
val = 0
for i in range(len(L)-1):
    if L[i][-1]  != L[i+1][0]:
        print("NO")
        quit()
print("YES")

Submission status: Accepted

Solution code:
a,b,c = input().split()
a_left=a[0]
a_right=a[-1]
b_left=b[0]
b_right=b[-1]
c_left=c[0]
c_right=c[-1]
if a_right == b_left and b_right == c_left:
  print("YES")
else:
  print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 0560 A - Shiritori
a,b,c =map(str,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = [ x for x in input().split() ]

ans = A[-1] == B[0] and B[-1] == C[0]

print("YES" if ans else "NO")
print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
result = "NO"
if a[-1] == b[0]:
    if b[-1] == c[0]:
        result = "YES"

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B,C=raw_input().split()
print["NO","YES"][A[-1]==B[0]and B[-1]==C[0]]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = raw_input().split()

if data[0][-1] == data[1][0] and data[1][-1] == data[2][0]:
    print 'YES'
else:
    print 'NO'

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re;print('YNEOS'[any(x!=y for x,_,y in re.findall('. .',input()))::2])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l=list(input().split())
count=0
if(l[0][-1]==l[1][0]):
  count+=1
if(l[1][-1]==l[2][0]):
  count+=1
if(count==2):
  print('YES')
else:print('NO')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
""" AtCoder """

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print('YES' if (lambda lists=input().split(): True if lists[0][-1] == lists[1][0] and lists[1][-1] == lists[2][0] else False )() else 'NO')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = [x for x in input().split()]
#print(a)#
if a[0][-1]==a[1][0] and a[1][-1]==a[2][0]: print('YES')
else: print('NO')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C = [_ for _ in input().split()]

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B,C = [s for s in input().split()]

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

Submission status: Accepted

Solution code:
str_a, str_b, str_c = input().split()

if str_a[-1] == str_b[0] and str_b[-1] == str_c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


abc060_a()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()
a= []
#for i in range(len(x)):
 #   a.append(int(x[i]))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A,B,C = map(str,input().split())
if A[-1] == B[0] and B[-1] == C [0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C = map(str,input().split())
a = list(A)
b = list(B)
c = list(C)
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input().strip().split(" ")

a0=list(a[0])
a1=list(a[1])
a2=list(a[2])

if(a0[-1]==a1[0] and a1[-1]==a2[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = a[-1]
B = b[-1]

if A == b[0] and B == c[0]:
	print("YES")
else :
	print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np,math,itertools
a,b,c=map(str,input().split())
if a[::-1][0]==b[0] and b[::-1][0]==c[0]:print("YES")
else:print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
listA = list(a)
listB = list(b)
listC = list(c)

if listA[len(listA)-1] == listB[0] and listB[len(listB)-1] == listC[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8
A, B, C = input().split()
print(["NO", "YES"][A[-1]==B[0] and B[-1]==C[0]])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

al = len(a)
bl = len(b)

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

else:
    print("NO")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(map(str,input().split()))
for i in range(2):
  if not a[i][-1] == a[i+1][0]:
    print("NO")
    exit()
else:
  print("YES")

Submission status: Accepted

Solution code:
S=list(input().split())
ans='YES'
for i in range(len(S)-1):
    if S[i][-1]!=S[i+1][0]:
        ans='NO'
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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