Cipher Decoder

Interview

Time limit1sMemory limit512 MB

Summary
Check whether the multiset of integers in the ciphertext matches the multiset of character codes of the given plaintext.
Level

Medium4 of 10

Topics
Hash map, Sorting, String, Implementation
Solved
No attempts yet

Problem

You just decoded an incoming ciphertext, and now you want to check whether the decoding has any errors. If the decoded sentence cannot be the result of interpreting the ciphertext, then the decoding is wrong.

The ciphertext consists of integers between 0 and 52 inclusive. 0 is interpreted as a space, numbers from 1 to 26 as A through Z, and numbers from 27 to 52 as a through z. The ciphertext is made by replacing every character, including spaces, with such an integer and then shuffling the order randomly.

Input

The first line gives N, the length of the sequence. (1 ≤ N ≤ 100,000)

The second line gives N numbers corresponding to the ciphertext, separated by spaces.

The third line gives the plaintext. The length of the plaintext equals N, and it does not begin or end with a space.

Output

Print "y" without quotes if the given ciphertext can be produced by encrypting the plaintext. Otherwise, print "n".

Examples2

  1. Example 1

    Input
    11
    44 0 38 41 38 31 23 8 41 30 38
    Hello World
    
    Expected output
    y
    
  2. Example 2

    Input
    5
    12 3 34 52 0
    apple
    
    Expected output
    n