#!/usr/local/gnu/bin/bash
read s
read t
s=`echo $s | fold -1 | sort | tr -d "\n"`
t=`echo $t | fold -1 | sort -r | tr -d "\n"`
f=`echo $s $t | tr ' ' '\n' | sort | head -1`
[ $s = $f -a $s != $t ] && echo Yes || echo No