#include #define REP(i,n) for(int i=0; i<(n); i++) using namespace std; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main() { string S; vector str; while( getline( cin, S ) ) { string tmp; tmp += S[0]; tmp += S[2]; tmp += S[4]; str.push_back( tmp ); } REP( i, (int)str.size() - 1 ) { if( str[ i ] < str[ i + 1 ] ) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }