stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    char A[11],B[11],C[11];

    cin>>A>>B>>C;

    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.318829465970716x):
#include<stdio.h>

#include<string.h>

int main(){

	

	char a[11];

	char b[11];

	char c[11];

	

	scanf("%s",a);

	scanf("%s",b);

	scanf("%s",c);

	

	int len1 = strlen(a);

	int len2 = strlen(b);

	int len3 = strlen(c);

	

	if(a[len1-1] == b[0]  &&  b[len2-1] == c[0]){

		printf("YES");

	}

	else{

		printf("NO");

	}

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

    string s,a,e;

    int c,d,j;

    cin>>s>>a>>e;

    c = s.size();

    d = a.size();

    j = e.size();

    if(s[c-1]==a[0]&&a[d-1]==e[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

    return 0;



}


// Faster C++ solution for the same problem (measured speedup: 5.40234119896589x):
#include <stdio.h>



int main(){

	char arr[355];

	scanf("%[^\n]", &arr);

	int test = 1;

	for(int i=0;arr[i]!='\0';i++){

		if(arr[i]==' '&&arr[i-1]!=arr[i+1]){

			test=0;

			break;

		}

	}

	if(test==1){

		printf("YES\n");

	}

	else {

		printf("NO\n");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    char A[11],B[11],C[11];

    cin>>A>>B>>C;

    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.361231092045805x):
#include <stdio.h>



int main(){

	char arr[355];

	scanf("%[^\n]", &arr);

	int test = 1;

	for(int i=0;arr[i]!='\0';i++){

		if(arr[i]==' '&&arr[i-1]!=arr[i+1]){

			test=0;

			break;

		}

	}

	if(test==1){

		printf("YES\n");

	}

	else {

		printf("NO\n");

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

    string s,a,e;

    int c,d,j;

    cin>>s>>a>>e;

    c = s.size();

    d = a.size();

    j = e.size();

    if(s[c-1]==a[0]&&a[d-1]==e[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

    return 0;



}


// Faster C++ solution for the same problem (measured speedup: 5.365411970224519x):
#include<stdio.h>

#include<string.h>



int main(){

	char A[11], B[11], C[11];

	scanf("%s  %s  %s", A, B, C);

	

	if (A[strlen(A) - 1] == B [0] && B[strlen(B) - 1]  == C [0]){

		printf ("YES\n");

	}

	else {

		printf ("NO\n");

	}

	

	return 0; 

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    char A[11],B[11],C[11];

    cin>>A>>B>>C;

    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.324582883048674x):
#include<stdio.h>

#include<string.h>



int main(){

	char A[11], B[11], C[11];

	scanf("%s  %s  %s", A, B, C);

	

	if (A[strlen(A) - 1] == B [0] && B[strlen(B) - 1]  == C [0]){

		printf ("YES\n");

	}

	else {

		printf ("NO\n");

	}

	

	return 0; 

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

    string s,a,e;

    int c,d,j;

    cin>>s>>a>>e;

    c = s.size();

    d = a.size();

    j = e.size();

    if(s[c-1]==a[0]&&a[d-1]==e[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

    return 0;



}


// Faster C++ solution for the same problem (measured speedup: 5.377904943560661x):
#include <stdio.h>

#include <string.h>

int main (){

	char d[14], e[14], f[14];

	scanf ("%s %s %s", &d, &e, &f);

		if ( d[strlen(d) - 1] == e[0] && e[strlen(e) - 1] == f[0]){

			puts ("YES\n");

		}else {

			puts ("NO\n");

		}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(void)

{

    char A[11],B[11],C[11];

    cin>>A>>B>>C;

    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.336980788811205x):
#include <stdio.h>

#include <string.h>

int main (){

	char d[14], e[14], f[14];

	scanf ("%s %s %s", &d, &e, &f);

		if ( d[strlen(d) - 1] == e[0] && e[strlen(e) - 1] == f[0]){

			puts ("YES\n");

		}else {

			puts ("NO\n");

		}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.413260906197842x):
#include <stdio.h>

#include <string.h>



int main() {

  char str[255];

  scanf("%[^\n]", str);

  int count = 0;



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i+1] == str[i-1]) {

      count++;

    }

  }



  (count == 2) ? puts("YES") : puts("NO");

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.413439764264437x):
#include <stdio.h>

#include <string.h>



int main() {

  char str[255];

  scanf("%[^\n]", str);

  int count = 0;



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i+1] == str[i-1]) {

      count++;

    }

  }



  (count == 2) ? puts("YES") : puts("NO");

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.380070501478949x):
#include <stdio.h>

#include <string.h>



int main(){

	char a[11], b[11], c[11];

	scanf("%s %s %s", a,b,c);

	int d=strlen(a)-1,e=strlen(b)-1;

	if(a[d]==b[0] && b[e]==c[0]){

		puts("YES");

	}else{

		puts("NO");

	}

	

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.380248262910498x):
#include <stdio.h>

#include <string.h>



int main(){

	char a[11], b[11], c[11];

	scanf("%s %s %s", a,b,c);

	int d=strlen(a)-1,e=strlen(b)-1;

	if(a[d]==b[0] && b[e]==c[0]){

		puts("YES");

	}else{

		puts("NO");

	}

	

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.4136439578978335x):
#include <stdio.h>



int main() {

  char str[31], ctr = 0;

  scanf("%[^\n]", str);



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i-1] == str[i+1]) {

      ctr++;

    }

  }

  if(ctr == 2) {

    puts("YES");

  }

  else {

    puts("NO");

  }

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.4138228286207335x):
#include <stdio.h>



int main() {

  char str[31], ctr = 0;

  scanf("%[^\n]", str);



  for(int i = 0; str[i] != '\0'; i++) {

    if(str[i] == ' ' && str[i-1] == str[i+1]) {

      ctr++;

    }

  }

  if(ctr == 2) {

    puts("YES");

  }

  else {

    puts("NO");

  }

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.364922796616071x):
#include <stdio.h>

#include <string.h>

int main (){

	char a[11],b[11],c[11];

	scanf("%s %s %s",&a,&b,&c);

	

	if (a [strlen(a)-1] == b [0] && b [strlen(b)-1] == c [0]){

		printf("YES");

	}

	else {

		printf("NO");

	}

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.365100057556465x):
#include <stdio.h>

#include <string.h>

int main (){

	char a[11],b[11],c[11];

	scanf("%s %s %s",&a,&b,&c);

	

	if (a [strlen(a)-1] == b [0] && b [strlen(b)-1] == c [0]){

		printf("YES");

	}

	else {

		printf("NO");

	}

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.363707356924972x):
#include <stdio.h>

#include <string.h>

int main(){

 	char A[15],B[15],C[15];

 	scanf("%s %s %s",&A,&B,&C);

 	int lenA=strlen(A);

 	int lenB=strlen(B);

 	

 	if(A[lenA-1]==B[0]&&B[lenB-1]==C[0]){

 		printf("YES");

	 }

	 else{

	 	printf("NO");

	 }

 	

	return 0;	

	}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.363884577706357x):
#include <stdio.h>

#include <string.h>

int main(){

 	char A[15],B[15],C[15];

 	scanf("%s %s %s",&A,&B,&C);

 	int lenA=strlen(A);

 	int lenB=strlen(B);

 	

 	if(A[lenA-1]==B[0]&&B[lenB-1]==C[0]){

 		printf("YES");

	 }

	 else{

	 	printf("NO");

	 }

 	

	return 0;	

	}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.364283765712274x):
#include <stdio.h>

#include <string.h>



int main()

{

    char A[11];

    char B[11];

    char C[11];



    scanf("%s %s %s", A, B, C);



    int lastA = strlen(A) - 1, lastB = strlen(B) - 1;



    if (A[lastA] == B[0] && B[lastB] == C[0])

    {

        printf("YES\n");

    }

    else

    {

        printf("NO\n");

    }



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.364461005538623x):
#include <stdio.h>

#include <string.h>



int main()

{

    char A[11];

    char B[11];

    char C[11];



    scanf("%s %s %s", A, B, C);



    int lastA = strlen(A) - 1, lastB = strlen(B) - 1;



    if (A[lastA] == B[0] && B[lastB] == C[0])

    {

        printf("YES\n");

    }

    else

    {

        printf("NO\n");

    }



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.351697385892816x):
#include <stdio.h>

#include <string.h>

int main(){

	char a[105],b[105],c[105];

	char l,m,n;

	scanf("%s %s %s" ,&a,&b,&c);

	for(int i = 0; i < strlen(a); i++){

		l = a[i];

	}

	for(int j = 0; j < strlen(b); j++){

		m = b[j];

	}

	for(int k = 0; k < strlen(c); k++){

		n = c[k];

	}

	if(l == b [0] && m == c[0]){

		printf("YES\n");

	}

	else{

		printf("NO\n");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.351874209856048x):
#include <stdio.h>

#include <string.h>

int main(){

	char a[105],b[105],c[105];

	char l,m,n;

	scanf("%s %s %s" ,&a,&b,&c);

	for(int i = 0; i < strlen(a); i++){

		l = a[i];

	}

	for(int j = 0; j < strlen(b); j++){

		m = b[j];

	}

	for(int k = 0; k < strlen(c); k++){

		n = c[k];

	}

	if(l == b [0] && m == c[0]){

		printf("YES\n");

	}

	else{

		printf("NO\n");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.4021187593051225x):
#include<stdio.h>



int main(){

  char word[100];

  scanf("%[^\n]", word);

	int ctr = 0;

	

  for(int i= 0; word[i] != '\0'; i++){

    if(word[i] == ' '){

		if(word[i - 1] == word[i + 1]){

			ctr++;

		}

    }

  }

  if(ctr == 2){

  	printf("YES\n");

  }

  else{

  	printf("NO\n");

  }

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.402297249227102x):
#include<stdio.h>



int main(){

  char word[100];

  scanf("%[^\n]", word);

	int ctr = 0;

	

  for(int i= 0; word[i] != '\0'; i++){

    if(word[i] == ' '){

		if(word[i - 1] == word[i + 1]){

			ctr++;

		}

    }

  }

  if(ctr == 2){

  	printf("YES\n");

  }

  else{

  	printf("NO\n");

  }

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.367555224514964x):
#include <stdio.h>

#include <string.h>

 

int main() {

	char a[100], b[100], c[100];

 

	scanf("%s %s %s", a, b, c);

	int x = strlen(a);

	int y = strlen(b);

	 if (a[x-1]==b[0] && b[y-1]==c[0])

	 {

	 	printf("YES\n");

	 }

	 else printf ("NO\n");

	 

	 return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.367732572432685x):
#include <stdio.h>

#include <string.h>

 

int main() {

	char a[100], b[100], c[100];

 

	scanf("%s %s %s", a, b, c);

	int x = strlen(a);

	int y = strlen(b);

	 if (a[x-1]==b[0] && b[y-1]==c[0])

	 {

	 	printf("YES\n");

	 }

	 else printf ("NO\n");

	 

	 return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.364793986256192x):
#include <stdio.h>

#include <string.h>



int main() {

	char a[15];

	char b[15];

	char c[15];

	scanf("%s %s %s", a, b, c);

	

	if(a[strlen(a)-1] == b[0] && b[strlen(b)-1] == c[0]){

		printf("YES");

	}

	else{

		printf("NO");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.364971242940598x):
#include <stdio.h>

#include <string.h>



int main() {

	char a[15];

	char b[15];

	char c[15];

	scanf("%s %s %s", a, b, c);

	

	if(a[strlen(a)-1] == b[0] && b[strlen(b)-1] == c[0]){

		printf("YES");

	}

	else{

		printf("NO");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.358305241851178x):
#include <stdio.h>

#include <string.h>



int main(){

    char A[12], B[12], C[12];

    scanf("%s %s %s", A, B, C);



    if(A[strlen(A) - 1] == B [0] && B[strlen(B) - 1] == C [0]){

        printf("YES\n");

    } else{

        printf("NO\n");

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.358482284142763x):
#include <stdio.h>

#include <string.h>



int main(){

    char A[12], B[12], C[12];

    scanf("%s %s %s", A, B, C);



    if(A[strlen(A) - 1] == B [0] && B[strlen(B) - 1] == C [0]){

        printf("YES\n");

    } else{

        printf("NO\n");

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;

int main()

{

    string a,b,c;

    char x,y,z,w;

    int d,e,f;

    cin>>a>>b>>c;

    d=a.size();

    x=a[d-1];

    y=b[0];

    e=b.size();

    z=b[e-1];

    w=c[0];



    if(x==y && z==w)

    {

        cout<<"YES"<<endl;

    }

    else

    {

        cout<<"NO"<<endl;

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.37388654402783x):
#include <stdio.h>

#include <string.h>



int main() {

	char A[15], B[15], C[15];

	int lenA, lenB;

	scanf("%s %s %s", A, B, C);

	

	lenA = strlen(A);

	lenB = strlen(B);

	if (A[lenA-1] == B[0] && B[lenB-1] == C[0]) {

		printf("YES\n");

	}

	else {

		puts("NO");

	}

	



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){



string a,b,c;

cin>>a>>b>>c;



int m,n;



m=a.length();

m--;

n=b.length();

n--;



if(a[m]==b[0]){

if(b[n]==c[0]){

cout<<"YES"<<endl;

}

else

cout<<"NO"<<endl;



}

else

cout<<"NO"<<endl;

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.374064101136939x):
#include <stdio.h>

#include <string.h>



int main() {

	char A[15], B[15], C[15];

	int lenA, lenB;

	scanf("%s %s %s", A, B, C);

	

	lenA = strlen(A);

	lenB = strlen(B);

	if (A[lenA-1] == B[0] && B[lenB-1] == C[0]) {

		printf("YES\n");

	}

	else {

		puts("NO");

	}

	



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;



main() {

    char A[100],B[100],C[100];

    int a,b,c;

    cin>>A;

    cin>>B;

    cin>>C;



    a=strlen(A);

    b=strlen(B);

    c=strlen(C);



    if(A[a-1]==B[0] && B[b-1]==C[0])

        cout<<"YES";

    else

        cout<<"NO";

}

// Faster C++ solution for the same problem (measured speedup: 5.309003907385813x):
#include <stdio.h>

#include <string.h>

int main (){

	char a[3][35];

	int length [3];

	for (int i = 0;i<3;i++){

	scanf ("%s", a[i]);

	length[i]=strlen(a[i]);

	}

	if(a[0][length[0]-1]== a[1][0] &&a[1][length[1]-1]==a[2][0]){

		printf("YES");

	}else{

		printf("NO");

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;



main() {

    char A[100],B[100],C[100];

    int a,b,c;

    cin>>A;

    cin>>B;

    cin>>C;



    a=strlen(A);

    b=strlen(B);

    c=strlen(C);



    if(A[a-1]==B[0] && B[b-1]==C[0])

        cout<<"YES";

    else

        cout<<"NO";

}

// Faster C++ solution for the same problem (measured speedup: 5.3106643652043015x):
#include <stdio.h>

#include <string.h>



int main(){

	char arr1[101];

	char arr2[101];

	char arr3[101];

	

	scanf ("%s %s %s", &arr1, &arr2, &arr3);

		if (arr1[(strlen(arr1)-1)] == arr2[0] && arr2[(strlen(arr2)-1)] == arr3[0]){

			printf ("YES");

		}

		else {

			printf ("NO");

		}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#include<string.h>

using namespace std;



main() {

    char A[100],B[100],C[100];

    int a,b,c;

    cin>>A;

    cin>>B;

    cin>>C;



    a=strlen(A);

    b=strlen(B);

    c=strlen(C);



    if(A[a-1]==B[0] && B[b-1]==C[0])

        cout<<"YES";

    else

        cout<<"NO";

}

// Faster C++ solution for the same problem (measured speedup: 5.310607262647605x):
#include <stdio.h>

#include <string.h>

int main(){

	

	char namaA[15];

	char namaB[15];

	char namaC[15];

	

	scanf("%s %s %s", &namaA,&namaB,&namaC);



	int panjangA = strlen(namaA) - 1;

	int panjangB = strlen(namaB) - 1;

	int panjangC = strlen(namaC) - 1;

	

	if(namaA[panjangA] == namaB[0] && namaB[panjangB] == namaC[0]){

		printf("YES\n");

	}

	else{

		printf("NO\n");

	}

	return 0;

}