const lines = require('fs') .readFileSync('/dev/stdin', 'utf-8') .trim().split('\n').values(); const A = [...lines.next().value].sort(); const B = [...lines.next().value].sort(); console.log(A.join() === B.join() ? 'YES' : 'NO');