a,b=2.times.map{gets.bytes.sort} puts a==b ? "YES" : "NO"