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:
from sys import stdin
a,b,c = stdin.readline().strip().split()
ans = 'NO'
if a[-1]==b[0] and b[-1]==c[0]:
 ans = 'YES'
print ans

Submission status: Accepted

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

    print(ans)

if __name__ == '__main__':
   solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

shiritori = "YES"

end = None

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

print(shiritori)

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

Solution code:
import sys

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

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

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:
n = input()
tmp_n = n.split(" ")

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

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

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

Submission status: Accepted

Solution code:
string = raw_input().split()
if string[0][-1] == string[1][0] and string[1][-1] == string[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:
# -*- coding: utf-8 -*-
def shiritori(a, b):
    return a[len(a)-1:] == b[:1]


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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a, b, c = map(str, raw_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=raw_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:

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

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

Submission status: Accepted

Solution code:
str1,str2,str3=input().split()
if str1[-1:]==str2[:1] and str2[-1:]==str3[:1]:
    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:
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')

Submission status: Accepted

Solution code:
a,b,c = map(str, raw_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:
def siritori(a):
    s1 = a[0]
    s2 = a[1]
    s3 = a[2]
    if s1[-1]==s2[0] and s2[-1]==s3[0]:
        print("YES")
    else:
        print("NO")

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if a_0[-1]==a_1[0] and a_1[-1]==a_2[0]:
  print "YES"
else:
  print "NO"

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:
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:
# coding: utf-8 
array = input().split(" ")
flag = True
for i,s in enumerate(array[:(len(array)-1)]):
    if s[-1] != array[i+1][0]:
        flag = False
if flag is True:
    print("YES")
else:
    print("NO")

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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 = 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()
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();print('YES'*(a[-1]==b[0])*(b[-1]==c[0])or'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:
# coding: utf-8

s = input().split()

# 最後の一文字
saigo = []
for i in range(2):
    tmp = s[i][len(s[i]) - 1:]
    saigo.append(tmp)

# しりとり判定
if saigo[0] == s[1][0:1] and saigo[1] == s[2][0:1]:
    print ("YES")
else:
    print ("NO")

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:
def main():
        s = input().split()

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

Submission status: Accepted

Solution code:
word = list(input().split())
if word[0][-1] == word[1][0] and word[1][-1] == word[2][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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

a, b, c = raw_input().split()
flag    = True

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

if flag == True:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
import sys

def solve():
    a, b, c = input().split()

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

    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    a = LS()
    f = True
    for i in range(1,3):
        if a[i][0] != a[i-1][-1]:
            f = False
            break

    if f:
        return 'YES'

    return 'NO'


print(main())

Submission status: Accepted

Solution code:
#ABC060A

a,b,c=raw_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

if __name__ == "__main__":
    A, B, C = raw_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[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[:1] and B[-1:] == C[:1]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a = raw_input()

b = a.split(' ')

if b[0][-1] == b[1][0] and b[1][-1] == b[2][0]:
  print "YES"
else:
  print "NO"

Submission status: Accepted

Solution code:
a = raw_input()

l = a.split(' ')

if l[0][-1] == l[1][0] and l[1][-1] == l[2][0]:
	print "YES"
else:
	print "NO"

Submission status: Accepted

Solution code:


ABC = input().split()


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

Submission status: Accepted

Solution code:
a = input().split()
b = list(a[0])
c = list(a[1])
d = list(a[2])
if b[-1] != c[0]:
    print('NO')
elif c[-1] != d[0]:
    print('NO')
else:
    print('YES')

Submission status: Accepted

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

if a[-1] != b[0]:
    print("NO")

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_shiritori(s):
    before_mozi = None
    for mozi in s.split():
        if before_mozi is None:
            before_mozi = mozi
            continue
        else:
            if mozi[0] is not before_mozi[-1]:
                print("NO")
                return False
            before_mozi = mozi
    print("YES")

ss = input()
is_shiritori(ss)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
moji=raw_input().split(" ")
flag=0
for i in range(len(moji)-1):
	if(moji[i][len(moji[i])-1]!=moji[i+1][0]):
		print "NO"
		flag=1
		break
if(flag==0):
	print "YES"

Submission status: Accepted

Solution code:
a = map(str, raw_input().split(" "))
first = ""
for i in a:
    if len(first)!=0:
        if i.startswith(first) == False:
            print "NO"
            exit()
    first = i[len(i)-1]
print "YES"

Submission status: Accepted

Solution code:
# coding: utf-8

a,b,c = input().rstrip().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:
# coding: utf-8
# 整数の入力
#a = int(raw_input())
# スペース区切りの整数の入力
import numpy as np
import itertools

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

Submission status: Accepted

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

Submission status: Accepted

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

al = a[-1]
bf = b[0]
bl = b[-1]
cf = c[0]

if al==bf and bl==cf:
    print("YES")

else:
    print("NO")

Submission status: Accepted

Solution code:
l = input().split()
def shiritori (letter):
    if letter[0][-1:] == letter[1][:1]:
        if letter[1][-1:] == letter[2][:1]:
            return(print('YES'))
        else:
            return(print('NO'))
    else:
        return(print('NO'))
shiritori(l)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import os
import sys

l = sys.stdin.readline()
l.rstrip('\n')
a, b, c = l.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=[i for i in input().split()]
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = raw_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())
ab, bc = (0, 0)

if a[-1] == b[0]:
    ab = 1
if b[-1] == c[0]:
    bc = 1
if ab==1 and bc==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:
import sys

s = input().split(' ') #['ringo', 'gorira', 'apple']

def isSeritori(A,B):
    if A[-1] == B[0] :
        return True
    else:
        return False

for i in range(2):
    if (isSeritori(s[i],s[i+1])):
        continue
    else:
        print('NO')
        sys.exit(0)
print('YES')

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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

Submission status: Accepted

Solution code:
import sys

a, b, c = sys.stdin.readline().rstrip().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:
#coding=UTF-8

mozir=input()
hyo=mozir.split(' ')

ans=True
for idx in range(0,2,1):
    ras=hyo[idx][len(hyo[idx])-1]
    cap=hyo[idx+1][0]
    if ras != cap:
        ans = False

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

Submission status: Accepted

Solution code:
l = raw_input().split(" ")

judge="YES"

if (l[0][-1] != l[1][0]):
    judge="NO"

if (l[1][-1] != l[2][0]):
    judge="NO"

print judge

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:
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:
S = input().split()
a2 = S[0][-1]
for i,s in enumerate(S):
	if i == 0:
		continue
	a1 = s[0]
	if a1 != a2:
		print("NO")
		break
	a2 = s[-1]
	if i == 2:
		print("YES")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
abc=  input()
 
a, b, c = abc.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:
#! -*- coding:utf-8 -*-
a,b,c = map(str,input().split())
a = list(a)
b = list(b)
c = list(c)
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    for line in sys.stdin:
        a, b, c = line.split(" ", 3)
        if a[-1] == b[0] and b[-1] == c[0]:
            print("YES")
        else:
            print("NO")

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(str,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:
# coding: utf-8

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

def main():
    line = sys.stdin.readline()
    lst = line.split()
    a = lst[0]
    b = lst[1]
    c = lst[2]

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

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

Solution code:
import sys
read=lambda:sys.stdin.readline().rstrip()
readi=lambda:int(sys.stdin.readline())
writeln=lambda x:sys.stdout.write(str(x)+"\n")
write=lambda x:sys.stdout.write(x)
A,B,C=read().split()
if A[-1] == B[0] and B[-1] == C[0]:
    writeln("YES")
else:
    writeln("NO")

Submission status: Accepted

Solution code:
### A - Shiritori
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:
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 = map(str, raw_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 = raw_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:
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 = raw_input().split()

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

Submission status: Accepted

Solution code:
import sys
import math

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

a, b, c = ns().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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <string.h>

int main(){
    
    char a[15], b[15], c[15];
    scanf("%s", a);
	scanf("%s", b);
	scanf("%s", c);
	
	int lena = strlen(a);
	int lenb = strlen(b);
	int lenc = strlen(c);
	
	if(a[lena-1] == b[0] && b[lenb-1] == c[0]){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	
	return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# 060_a
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[0] == C[len(B) - 1]):
        print('YES')
    else:
        print('NO')

Submission status: Runtime Error

Solution code:
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
# input = sys.stdin.readline 
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 = i_map()

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
A = str(input())
B = str(input())
C = str(input())

if A == B and B == C:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

for i in range(1,B):
    a = A*i
    if a % B == C:
        print('YES')
        exit()
print('NO')

Submission status: Runtime Error

Solution code:
import sys

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


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

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
A = input()
B = input()
C = input()
if A[-1] == B[0] and B[-1] == C[0]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
for k in range(B):
    if (k * A) % B == C: print("YES"); exit()
print("NO")

Submission status: Runtime Error

Solution code:
A = input()
B = input()
C = input()
if 1 <= len(A):
    if len(A) <= 10:
        if 1 <= len(B):
            if len(B) <= 10:
                if 1 <= len(C):
                    if len(C) <= 10:
                        if A >= 'a':
                            if A <= 'z':
                                if B >= 'a':
                                    if B <= 'z':
                                        if C >= 'a':
                                            if C <= 'z':
                                                if A[len(A)-1] == B[0]:
                                                    if B[len(B)-1] == C[0]:
                                                        print("YES")
                                                    else:
                                                        print("NO")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

Solution code:
a,b,c=map(int,input().split())
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

If A==B and B1==C:
    print(“YES”)
else:
    print(“NO”)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = input()

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

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a,b,c=map(int, input().split());print("YNeos"[a[-1]!=b[0]or b[-1]!=c[0]::2])