Dictionary of Banned Ingredients#1236

Dictionary of Banned Ingredients

1 second
64 megabytes
Medium

A food safety system maintains a list of banned and allergen ingredients S_1, S_2, \ldots, S_n. Given a recipe text , determine whether the text contains any of the ingredients from the list as a subsequence. If it does, find the length of the smallest prefix of that contains such a subsequence.

Input

The first line contains an integer — the number of banned ingredients in the list. The following lines each contain one ingredient name from the list. The next line contains the recipe text . The total length of all ingredient names in the dictionary does not exceed KiB (100 \times 2^{10} bytes). The total size of the input file does not exceed MiB (2^{20} bytes). The ingredient names and the text consist of characters with ASCII codes from to , inclusive.

Output

If the text does not contain any of the banned ingredients from the list as a subsequence, output NO. Otherwise, output YES , where is the length of the smallest prefix of that contains some banned ingredient as a subsequence.

Examples

Example 1

Loading
Loading