use std::io::{self, Read};

fn read_stdin() -> Vec<String> {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).ok();
    buffer.trim().split('\n').map(|s| s.to_string()).collect()
}

fn main() {
    let input = read_stdin();
    let bytes = input
        .iter()
        .map(|s| {
            let mut x = s.as_bytes().to_vec();
            x.sort();
            String::from_utf8(x).unwrap()
        })
        .collect::<Vec<String>>();
    println!("{}", if &bytes[0] == &bytes[1] { "YES" } else { "NO" });
}