output_description: Print `YES` or `NO`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B C
attempt: import sys, re, os
  from collections import deque, defaultdict, Counter
  from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
  from itertools import permutations, combinations, product, accumulate
  from operator import itemgetter, mul
  from copy import deepcopy
  from string import ascii_lowercase, ascii_uppercase, digits
  from fractions import gcd
   
  def input(): return sys.stdin.readline().strip()
  def INT(): return int(input())
  def MAP(): return map(int, input().split())
  def LIST(): return list(map(int, input().split()))
  def S_LIST(): return list(map(str, input().split()))
  
  sys.setrecursionlimit(10 ** 9)
  INF = float('inf')
  mod = 10 ** 9 + 7
  
  A, B, C = S_LIST()
  if A[-1] == B[0] and B[-1] = C[0]:
      print("YES")
  else:
      print("NO")
problem_description: 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`.
samples: [{"input": "rng gorilla apple", "output": "YES\n    \n\nThey form a word chain.\n\n* * *"}, {"input": "yakiniku unagi sushi", "output": "NO\n    \n\nA and B form a word chain, but B and C do not.\n\n* * *"}, {"input": "a a a", "output": "YES\n    \n\n* * *"}, {"input": "aaaaaaaaab aaaaaaaaaa aaaaaaaaab", "output": "NO"}]