#ABC054B. Template Matching

Template Matching

Problem Statement

You are given an image AA composed of NN rows and NN columns of pixels, and a template image BB composed of MM rows and MM columns of pixels.

A pixel is the smallest element of an image, and in this problem it is a square of size 1×11×1.

Also, the given images are binary images, and the color of each pixel is either white or black.

In the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.

The image AA is given as NN strings A1,...,ANA_1​,...,A_N​.

The jj-th character in the string AiA_i​ corresponds to the pixel at the ii-th row and jj-th column of the image A(1i,jN)A(1≤i,j≤N).

Similarly, the template image B is given as MM strings B1,...,BMB_1​,...,B_M​.

The jj-th character in the string BiB_i​ corresponds to the pixel at the ii-th row and jj-th column of the template image B(1i,jM)B(1≤i,j≤M).

Determine whether the template image BB is contained in the image AA when only parallel shifts can be applied to the images.

Constraints

  • 1MN501≤M≤N≤50
  • AiA_i​ is a string of length NN consisting of # and ..
  • BiB_i​ is a string of length MM consisting of # and ..

Input

The input is given from Standard Input in the following format:

N M
A1​
A2​
:  
AN​
B1​
B2​
:  
BM​

Output

Print Yes if the template image BB is contained in the image AA. Print No otherwise.

Samples

3 2
#.#
.#.
#.#
#.
.#
Yes

The template image BB is identical to the upper-left 2×22×2 subimage and the lower-right 2×22×2 subimage of AA. Thus, the output should be Yes.

4 1
....
....
....
....
#
No

The template image BB, composed of a black pixel, is not contained in the image AA composed of white pixels.