#D13007. Colorful Drink

    ID: 10815 Type: Default 2000ms 536MiB

Colorful Drink

Colorful Drink

In the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order.

You have already prepared several colored liquids with various colors and densities. You will receive a drink request with specified color layers. The colorful drink that you will serve must satisfy the following conditions.

  • You cannot use a mixed colored liquid as a layer. Thus, for instance, you cannot create a new liquid with a new color by mixing two or more different colored liquids, nor create a liquid with a density between two or more liquids with the same color by mixing them.
  • Only a colored liquid with strictly less density can be an upper layer of a denser colored liquid in a drink. That is, you can put a layer of a colored liquid with density xx directly above the layer of a colored liquid with density yy if x<yx < y holds.

Your task is to create a program to determine whether a given request can be fulfilled with the prepared colored liquids under the above conditions or not.

Input

The input consists of a single test case in the format below.

NN C1C_1 D1D_1 \vdots CNC_N DND_N MM O1O_1 \vdots OMO_M

The first line consists of an integer NN (1N1051 \leq N \leq 10^5), which represents the number of the prepared colored liquids. The following NN lines consists of CiC_i and DiD_i (1iN1 \leq i \leq N). CiC_i is a string consisting of lowercase alphabets and denotes the color of the ii-th prepared colored liquid. The length of CiC_i is between 11 and 2020 inclusive. DiD_i is an integer and represents the density of the ii-th prepared colored liquid. The value of DiD_i is between 11 and 10510^5 inclusive. The (N+2N+2)-nd line consists of an integer MM (1M1051 \leq M \leq 10^5), which represents the number of color layers of a drink request. The following MM lines consists of OiO_i (1iM1 \leq i \leq M). OiO_i is a string consisting of lowercase alphabets and denotes the color of the ii-th layer from the top of the drink request. The length of OiO_i is between 11 and 2020 inclusive.

Output

If the requested colorful drink can be served by using some of the prepared colored liquids, print 'Yes'. Otherwise, print 'No'.

Examples

Input

2 white 20 black 10 2 black white

Output

Yes

Input

2 white 10 black 10 2 black white

Output

No

Input

2 white 20 black 10 2 black orange

Output

No

Input

3 white 10 red 20 white 30 3 white red white

Output

Yes

Input

4 red 3444 red 3018 red 3098 red 3319 4 red red red red

Output

Yes

inputFormat

Input

The input consists of a single test case in the format below.

NN C1C_1 D1D_1 \vdots CNC_N DND_N MM O1O_1 \vdots OMO_M

The first line consists of an integer NN (1N1051 \leq N \leq 10^5), which represents the number of the prepared colored liquids. The following NN lines consists of CiC_i and DiD_i (1iN1 \leq i \leq N). CiC_i is a string consisting of lowercase alphabets and denotes the color of the ii-th prepared colored liquid. The length of CiC_i is between 11 and 2020 inclusive. DiD_i is an integer and represents the density of the ii-th prepared colored liquid. The value of DiD_i is between 11 and 10510^5 inclusive. The (N+2N+2)-nd line consists of an integer MM (1M1051 \leq M \leq 10^5), which represents the number of color layers of a drink request. The following MM lines consists of OiO_i (1iM1 \leq i \leq M). OiO_i is a string consisting of lowercase alphabets and denotes the color of the ii-th layer from the top of the drink request. The length of OiO_i is between 11 and 2020 inclusive.

outputFormat

Output

If the requested colorful drink can be served by using some of the prepared colored liquids, print 'Yes'. Otherwise, print 'No'.

Examples

Input

2 white 20 black 10 2 black white

Output

Yes

Input

2 white 10 black 10 2 black white

Output

No

Input

2 white 20 black 10 2 black orange

Output

No

Input

3 white 10 red 20 white 30 3 white red white

Output

Yes

Input

4 red 3444 red 3018 red 3098 red 3319 4 red red red red

Output

Yes

样例

2
white 10
black 10
2
black
white
No