Match

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3531
64-bit integer IO format: %I64d      Java class name: Main

Description

There is a matrix of size n*n whose elements are either 0 or 1. Now your task is to find out that given a matrix of size m*m whose elements are also 0 or 1 whether it is a sub-matrix of the previous matrix.

Input

There is a matrix of size n*n whose elements are either 0 or 1. Now your task is to find out that given a matrix of size m*m whose elements are also 0 or 1 whether it is a sub-matrix of the previous matrix.

Output

If the second matrix is a sub-matrix of the first one, print “Yes” on a single line. Otherwise print “No”.

Sample Input

4 2
0 0 0 1
0 1 0 1
1 0 1 0
0 0 0 0
1 0
0 0
3 2
0 0 1
0 1 0
1 0 0
0 0
1 1

Sample Output

Yes
No

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .