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`.

Examples

Input

rng gorilla apple


Output

YES


Input

yakiniku unagi sushi


Output

NO


Input

a a a


Output

YES


Input

aaaaaaaaab aaaaaaaaaa aaaaaaaaab


Output

NO
#include <bits/stdc++.h>
int yomisute(char str[], int i) {
  while (str[i] != ' ') {
    i++;
  }
  return i;
}
int main(void) {
  int a_num, b_num, c_num, d_num;
  char a, b, c, d;
  char str[72];
  fgets(str, sizeof(str), stdin);
  a_num = yomisute(str, 0) - 1;
  a = str[a_num];
  b_num = a_num + 2;
  b = str[b_num];
  c_num = yomisute(str, b_num) - 1;
  c = str[c_num];
  d_num = c_num + 2;
  d = str[d_num];
  printf("%c%c%c%c\n", a, b, c, d);
  if ((a == b) && (c == d)) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}
