program name
    use,intrinsic :: iso_fortran_env
    implicit none
    character(100)::s,t
    integer(int32):: i
    integer(int32), allocatable:: si(:),ti(:)

    read*, s
    read*, t
    allocate(si(len_trim(s)), ti(len_trim(t)))
    do i=1, size(si)
        si(i) = ichar(s(i:i))
    end do
    
    do i = 1, size(ti)
        ti(i) = ichar(t(i:i))
    end do

    if (minval(si) < maxval(ti)) then
        print'(a)', 'Yes'
    else if (minval(si) > maxval(ti)) then
        print'(a)', 'No'
    else
        if (maxval(si) > maxval(ti)) then
            print'(a)', 'No'
        else if (size(si) < size(ti)) then
            print'(a)', 'Yes'
        else
            print'(a)', 'No'
        end if
    end if
end program name