// editor2

#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    int data;
    struct Node *next;
    struct Node *prev;
}Node;

Node *head=NULL, *tail=NULL;

void addNode(int data){
    Node *newNode=(Node*)malloc(sizeof(Node));
    newNode->data=data;
    newNode->next=newNode->prev=NULL;
    if(head==NULL){
        head=newNode;
    }
    else{
        tail->next=newNode;
        tail=newNode;
    }
}

int isPalindrome(){
    int pali=1;
    Node *frw=head;
    Node *bck=tail;
    while(frw!=bck){
        if(!frw->data==bck->data){
            pali=0
        }
        frw=frw->next;
        bck=bck->prev;
    }
    return pali
}

int main(){
    int data;
    while(data!=-1){
        if(!scanf("%d", &data)){
            printf("Invalid input")
        }
        addNode(data);
    }
    if(isPalindrome()){
        printf("Yes");
    }
    else{
        printf("No");
    }
}