#include<stdio.h>
#include<string.h>
#include<ctype.h>
int isvalid(char s[])
{
    for(int i=0;s[i]!='\0';i++){
        if(isalpha(s[i]) && s[i]!=' ')
        return 0;
    }
    return 1;
}
int main(){
    char str[101],str2[101];
    fgets( str1, sizeof(str1),stdin);
    fgets( str2, sizeof(str2),stdin);
    
    str[strcspn(str1,"\n")] ='\0';
    str[strcspn(str2,"\n")] ='\0';
    
    if(!isvalid(str1)||!isvalid(str2)==0){
        printf("Invalid input");
    }
    else if(strcmp(str1,str2)==0){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}