a,b=2.times.map{gets.chomp.split(/./).sort} puts a==b ? "YES" : "NO"