#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++) 
#define sort(v) sort(v.begin(),v.end());
const ll mod = 1E9+7;

int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c;
}
#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;
}