puts [gets, gets].map(&:chars).map(&:sort).inject(:==) ? "YES" : "NO"