#include <cstdio>
using namespace std;

int main()
{
    int ball[10],index=0;
    for(int i=0;i<10;++i) {
        scanf("%d",&ball[i]);
    }
    while(index+2 <= 9) {
        if(ball[index] < ball[index+1]) {
            ++index;
            continue;
        } else if (ball[index] < ball[index+2]) {
            ++index;
            continue;
        } else {
            puts("NO");
            return -1;
        }
    }
    puts("YES");
    return 0;
}