def amazingStrings(first, second, third):

new_s = first + second

if len(new_s) != len(third):

return "NO"

s1 = {}

s2 = {}

for ele in new_s:

s1[ele] = s1.get(ele, 0) + 1

for ele in third:

s2[ele] = s2.get(ele, 0) + 1

s1 = sorted(s1)

s2 = sorted(s2)

if s1 != s2:

return "NO"

return "YES"