#include <stdio.h>

int main(void){

  int n,m;
  scanf("%d %d", &n, &m);
  char a[n][n+1];
  char b[m][m+1];
  for (int i = 0; i < n; i++) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", b[i]);
  }

  int match = 0;
  int flag;
  for (int i = 0; i < n-m+1; i++) {
    for (int j = 0; j < n-m+1; j++) {
      flag = 0;
      for (int row = 0; row < m; row++) {
        for (int column = 0; column < m; column++) {
          if (a[i+row][j+column] != b[row][column]) {
            flag = 1;
            break;
          }
        }
        if (flag == 1) {
          break;
        }
      }
      if (flag == 0) {
        match = 1;
      }
      if (match == 1) {
        break;
      }
    }
    if (match == 1) {
      break;
    }
  }
  if (match == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


#include<stdio.h>

int main(){
    int n,m;
    scanf("%d%d",&n,&m);

    int a[n][n],b[m][m];
    for(int i=0;i<n;i++){
        char temp[n];
        scanf("%s",temp);
        for(int j=0;j<n;j++){
            if(temp[j]=='#'){
                a[i][j]=0;
            }else{
                a[i][j]=1;
            }
        }
    }
    for(int i=0;i<m;i++){
        char temp[n];
        scanf("%s",temp);
        for(int j=0;j<m;j++){
            if(temp[j]=='#'){
                b[i][j]=0;
            }else{
                b[i][j]=1;
            }
        }
    }

    int judge;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i][j]==b[0][0]){
                judge=0;
                for(int k=0;k<m;k++){
                    for(int l=0;l<m;l++){
                        if(a[i+k][j+l]!=b[k][l]){
                            judge++;
                        }
                    }
                }
                if(judge==0){
                    break;
                }
            }
        }
        if(judge==0){
            break;
        }
    }

    if(judge==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N, M;

    scanf("%d%d", &N, &M);

    char A[N][N+1], B[M][M+1];

    for(int i = 0; i < N; i++){
        scanf("%s", A[i]);
    }
    for(int i = 0; i < M; i++){
        scanf("%s", B[i]);
    }

    int t = 0;

    for(int i = 0; i <= N-M; i++){
        if(t == 1){
            break;
        }
        for(int j = 0; j <= N-M; j++){
            if(t == 1){
                break;
            }
            for(int k = 0; k < M; k++){
                if(t == 1){
                    break;
                }
                int f = 0;
                for(int l = 0; l < M; l++){
                    if(B[k][l] != A[i+k][j+l]){
                        f = 1;
                        break;
                    }
                }
                if(f == 0){
                    t = 1;
                }
            }
        }
    }

    if(t == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}


#include <stdio.h>
#include <string.h>
int main(void){
    int N, M, b_fase=0;
    char A[50][50], B[50][50];
    scanf("%d%d", &N, &M);
    for (int i=0; i<N; i++) scanf("%s", A[i]);
    for (int i=0; i<M; i++) scanf("%s", B[i]);

    for(int i=0; i<N; i++){
        for(int j=0; j<=N-M; j++){
            if(strcmp(A[i]+j, B[0])==0){
                for(int k=0; k<M; k++){
                    if(strcmp(A[i+k]+j, B[k])!=0) break;
                    if(k==M-1){
                        printf("Yes");
                        return 0;
                    }
                }
            }
        }
    }
    printf("No");
    return 0;
}


'use strict'
function main(input) {
  input = input.trim().split('\n')
  let size = input.shift().split(' ').map(val => Number(val))
  let sizeDiff = size[0] - size[1]
  let N = []
  let M = []
  let result = 0

  for (let i = 0; i < size[0]; i++) {
    N.push(input.shift())
  }
  for (let i = 0; i < size[1]; i++) {
    M.push(input.shift())
  }

  for (let i = 0; i <= sizeDiff; i++) {
    while (result !== -1) {
      result = N[i].indexOf(M[0], result)
      if (result !== -1) {
        let check = true
        for (let j = 1; j < size[1]; j++) {
          if (check) {
            check = N[i+j].indexOf(M[j], result) === result
          }
        }
        if (check) {
          console.log('Yes')
          return
        }
      }
      if (result !== -1) result++
    }
    result = 0
  }
  console.log('No')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=t.in(),n=new Array(e),i=0;i<e;i++)n[i]=t.inr();for(var o=new Array(r),s=0;s<r;s++)o[s]=t.inr();for(var u=0;u<e-r+1;u++)for(var c=0;c<e-r+1;c++){for(var f=!0,a=0;a<r;a++){for(var l=0;l<r;l++)if(o[a][l]!=n[u+a][c+l]){f=!1;break}if(!f)break}if(f)return void console.log("Yes")}console.log("No")}}]);


'use strict';
const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const info = input.splice('\n');
const N = info[0].split(' ')[0];
const M = info[0].split(' ')[1];
const As = info.splice(1 , N);
const Bs = info.splice(1 , M);
let isMatch = "";

// 4重for文でぶん回していく
for(let ax = 0; ax < N - M + 1; ax++){
  for(let ay = 0; ay < N - M + 1; ay++){
    // マッチするかのフラグを用意
    isMatch = true;
   	// ループぬけ用のラベル
    // labelは繰り返しの手前につけないといけないらしい
    loopReset:
    // 小さい方の四角形の1つずつ吟味するfor文
    for(let bx = 0; bx < M; bx++){
	  for(let by = 0; by < M; by++){
        if(As[ax + bx][ay + by] == Bs[bx][by]){
        	continue;
        } else {
        	isMatch = false;
            break loopReset;
        }
      }
    }
    if(isMatch){
    	console.log("Yes");
      	return;
    }
  }
}
console.log("No");


function main(input) {
  const args = input.split('\n');
  let ans = 'No';
  const ary1 = args[0].split(' ').map(n => parseInt(n, 10));
  const A = ary1[0];
  const B = ary1[1];
  const loop = (A >= B) ? B : A; //横回しで使う
  let aryA = [];
  let aryB = [];

  //必要文字のみの配列作成
  for (let i = 1; i <= A; i++) {
    aryA.push(args[i].split('').slice(0, loop));
  }

  for (let i = 1; i <= loop; i++) {
    aryB.push(args[A + i].split(''));
  }

  //重複削除
  let aryUA = uniqueAry(aryA);
  let aryUB = uniqueAry(aryB);

  //一致するか確認
  for (let i = 0; i < aryUB.length; i++) {
    for (let j = 0; j < aryUA.length; j++) {
      for(let k = 0; k < loop; k++) {
        if (aryUB[i][k] === aryUA[j][k]) {
          ans = 'Yes';
        }
      }
    }
  }

  console.log(ans);
}

function uniqueAry(ary) {
  unique_ary = ary.filter((e, index) => {
    return !ary.some((e2, index2) => {
      return index > index2 && e[0] == e2[0] && e[1] == e2[1];
    });
  });
  return unique_ary;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input) {
  const args = input.split('\n');
  let ans = 'Yes';
  const ary1 = args[0].split(' ').map(n => parseInt(n, 10));
  const A = ary1[0];
  const B = ary1[1];
  const loop = (A >= B) ? B : A;

  //小さい方で回す
  for (let i = 1; i <= (loop); i++) {
    aryA = args[i].split(''); //A
    aryB = args[i + A].split(''); //B

    for(let j = 0; j <= (loop - 1); j++) {
      if (aryA[j] !== aryB[j]) ans = 'No';
    }
  }

  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


!function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=0)}([function(t,r,n){"use strict";function e(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],e=!0,o=!1,i=void 0;try{for(var u,l=t[Symbol.iterator]();!(e=(u=l.next()).done)&&(n.push(u.value),!r||n.length!==r);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==l.return||l.return()}finally{if(o)throw i}}return n}(t,r)||function(t,r){if(!t)return;if("string"==typeof t)return o(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,r)}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function i(t){var r=t.split("\n");""==r[r.length-1]&&r.pop(),this.l=r,this.y=0}i.prototype.ints=function(){return this.l[this.y++].split(" ").map((function(t){return+t}))},i.prototype.intv=function(){var t=this.y;return this.y=this.l.length,this.l.slice(t).map((function(t){return+t}))},i.prototype.strv=function(){var t=this.y;return this.y=this.l.length,this.l.slice(t)},i.prototype.strn=function(t){var r=this.y;return this.y+=t,this.l.slice(r,r+t)};var u=new i(n(1).readFileSync("/dev/stdin","utf8"));!function(){var t,r,n=e(u.ints(),2);t=n[0],r=n[1];for(var o=u.strn(t),i=u.strn(r),l=0;l<t-r;++l)for(var f=0;f<t-r;++f){for(var a=!0,c=0;c<r&&a;c++)for(var s=0;s<r&&a;s++)a=a&&o[l+c][f+s]==i[c][s];if(a)return console.log("Yes"),0}console.log("No")}()},function(t,r){t.exports=require("fs")}]);


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)

	a := make([]string, n)
	b := make([]string, m)
	for i := 0; i < n; i++ {
		a[i] = getNextString(scanner)
	}
	for i := 0; i < m; i++ {
		b[i] = getNextString(scanner)
	}
	for i := 0; i+m <= n; i++ {
		for j := 0; j+m <= n; j++ {
			if equal(i, j, a, b) {
				fmt.Fprintln(writer, "Yes")
				return
			}
		}
	}

	fmt.Fprintln(writer, "No")
}

func equal(i, j int, a, b []string) bool {
	m := len(b)
	for k := 0; k < m; k++ {
		for l := 0; l < m; l++ {
			if a[i+k][j+l] != b[k][l] {
				return false
			}
		}
	}
	return true
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
	n, m := scanInt(), scanInt()
	a := make([]string, n)
	for i := range a {
		a[i] = scanString()
	}
	b := make([]string, m)
	for i := range b {
		b[i] = scanString()
	}

	for ai := 0; ai < n-m+1; ai++ {
		for aj := 0; aj < n-m+1; aj++ {
		L:
			for bi := 0; bi < m; bi++ {
				for bj := 0; bj < m; bj++ {
					if a[ai+bi][aj+bj] != b[bi][bj] {
						break L
					}
					if bi == m-1 && bj == m-1 {
						fmt.Println("Yes")
						return
					}
				}
			}
		}
	}
	fmt.Println("No")
}


package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	N := getInt()
	M := getInt()
	A := make([][]int, N)
	for i := 0; i < N; i++ {
		A[i] = make([]int, N)
		for j, c := range getString() {
			if c == '.' {
				A[i][j] = 1
			}
		}
	}
	B := make([][]int, M)
	for i := 0; i < M; i++ {
		B[i] = make([]int, M)
		for j, c := range getString() {
			if c == '.' {
				B[i][j] = 1
			}
		}
	}

	result := "No"
	for ai := 0; ai <= N - M; ai++ {
		for aj := 0; aj <= N - M; aj++ {
			flag := true
			for bi := 0; bi < M; bi++ {
				for bj := 0; bj < M; bj++ {
					if A[ai + bi][aj + bj] != B[bi][bj] {
						flag = false
						break
					}
				}

				if !flag {
					break
				}
			}

			if flag {
				result = "Yes"
				break
			}
		}

		if result == "Yes" {
			break
		}
	}

	fmt.Println(result)
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func bfs(c int, graph *Graph) {
	next := make([]int, 0)
	next = append(next, c)
	visited := make(map[int]struct{})

	for ; len(next) != 0; {
		u := next[0]
		next = next[1:]
		visited[u] = struct{}{}

		for _, v := range graph.edges[u] {
			_, flag := visited[v]
			if flag {
				continue
			}

			// なにか処理

			next = append(next, v)
		}
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntArray(n int) []int {
	array := make([]int, n)
	for i := 0; i < n; i++ {
		array[i] = getInt()
	}
	return array
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringArray(n int) []string {
	array := make([]string, n)
	for i := 0; i < n; i++ {
		array[i] = getString()
	}
	return array
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return calcMod(n * powMod(n, p-1))
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func isPrime(n int) bool {
	if n < 2 {
		return false
	} else if n == 2 {
		return true
	} else if n % 2 == 0 {
		return false
	}

	sqrtN := int(math.Sqrt(float64(n)))
	for i := 3; i <= sqrtN; i += 2 {
		if n % i == 0 {
			return false
		}
	}

	return true
}

func contains(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}

func makeRange(min, max int) []int {
	a := make([]int, max-min+1)
	for i := range a {
		a[i] = min + i
	}
	return a
}

func powerset2(nums []int) [][]int {
	length := int(math.Pow(2, float64(len(nums))))
	result := make([][]int, length)

	index := 0
	result[index] = []int{}
	index++

	for _, n := range nums {
		max := index
		for i := 0; i < max; i++ {
			result[index] = copyAndAppend(result[i], n)
			index++
		}
	}

	return result
}

func copyAndAppend(nums []int, n int) []int {
	dst := make([]int, len(nums)+1)
	copy(dst, nums)
	dst[len(nums)] = n
	return dst
}

func calcGcd(x, y int) int {
	if y == 0 {
		return x
	} else if x >= y {
		return calcGcd(y, x % y)
	} else {
		return calcGcd(x, y % x)
	}
}

func getDivisor(n int) []int {
	var divisor []int
	divisor = append(divisor, 1)
	if n != 1 {
		divisor = append(divisor, n)
	}

	sqrt := int(math.Sqrt(float64(n)))
	for i := 2; i <= sqrt; i++ {
		if n % i == 0 {
			divisor = append(divisor, i)
			divisor = append(divisor, n/i)
		}
	}
	return divisor
}

type intHeap []int

func (h intHeap) Len() int {
	return len(h)
}

func (h intHeap) Less(i, j int) bool {
	return h[i] > h[j]
}

func (h intHeap) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}

func (h *intHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *intHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func initHeap() *intHeap {
	ih := &intHeap{}
	heap.Init(ih)
	return ih
}

func (h *intHeap) pushHeap(n int) {
	heap.Push(h, n)
}

func (h *intHeap) popHeap() int {
	return heap.Pop(h).(int)
}

func factMod(n int) int {
	value := 1
	for ; n > 1; n-- {
		value = calcMod(value * n)
	}
	return value
}

func combinationMod(n, k int) int {
	factN := factMod(n)
	factK := factMod(k)
	factNK := factMod(n - k)
	factKR := powMod(factK, mod - 2)
	factNKR := powMod(factNK, mod - 2)
	return calcMod(factN * calcMod(factKR * factNKR))
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M, A, B := nextInt(), nextInt(), []string{}, []string{}

	for i := 0; i < N; i++ {
		A = append(A, nextLine())
	}
	for i := 0; i < M; i++ {
		B = append(B, nextLine())
	}

	fmt.Printf("%s\n", ABC054B(A, B))
}

// ABC054B ...
func ABC054B(A, B []string) string {
	for i := 0; i < len(A)-len(B); i++ {
		for j := 0; j < len(A[i])-len(B); j++ {
			if A[i][j:j+len(B)] == B[0] {
				if checkUnderRect(A, B, i, j) {
					return "Yes"
				}
			}
		}
	}

	return "No"
}

func checkUnderRect(A, B []string, i, j int) bool {
	for k := 1; k < len(B); k++ {
		ak := k + i
		if A[ak][j:j+len(B)] != B[k] {
			return false
		}
	}

	return true
}


package main

import "fmt"

func main() {
	// Code for B - Template Matching
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	A := make([]string, N)
	B := make([]string, M)

	for i := 0; i < N; i++ {
		fmt.Scanf("%s", &A[i])
	}

	for i := 0; i < M; i++ {
		fmt.Scanf("%s", &B[i])
	}

	var flag1, flag2 int
	for i := 0; i < (N - M + 1); i++ {
		for j := 0; j < (N - M + 1); j++ {
			flag1 = 0
			for k := 1; k <= M; k++ {
				if A[i][j:j+k] != B[0][0:k] {
					flag1 = 1
				}
			}
			if flag1 == 0 {
				flag2 = 1
				break
			}
		}
	}

	if flag2 == 0 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


// やるだけだがこれ緑difなんすね
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	N, M := nextInt(), nextInt()
	A, T := make([][]string, N), make([][]string, M)
	for i := 0; i < N; i++ {
		A[i] = chars(next())
	}
	for i := 0; i < M; i++ {
		T[i] = chars(next())
	}
	for i := 0; i < N-M; i++ {
		for j := 0; j < N-M; j++ {
			flag := true
			for y := 0; y < M; y++ {
				for x := 0; x < M; x++ {
					if A[i+y][j+x] != T[y][x] {
						flag = false
					}
				}
			}
			if flag {
				fmt.Fprintln(out, "Yes")
				return
			}
		}
	}
	fmt.Fprintln(out, "No")
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


n,m=gets.split.map(&:to_i)
N=[]
n.times{N<<gets.chomp}
m.times{|i|!N[i].index(gets.chomp)?(puts :No;exit):m+=1}
puts:Yes


# frozen_string_literal: true

def select_index(str, substr)
  i = 0
  indexs = []
  loop do
    index = str.index(substr, i)
    return indexs unless index

    indexs << index
    i = index + 1
  end

  indexs
end

n, m = gets.split(' ').map!(&:to_i)

a = []
b = []
n.times { a << gets.chomp! }
m.times { b << gets.chomp! }

ans = 'No'

first_line = b.shift
a.each.with_index do |a_s, i|
  select_index(a_s, first_line).each do |index|
    match = true
    b.each.with_index(1) do |b_s, j|
      if a[i + j].nil? || b_s != a[i + j].slice(index, m)
        match = false
        break
      end
    end
    if match
      ans = 'Yes'
      break
    end
  end
  break if ans == 'Yes'
end

puts ans


n,m=gets.split.map(&:to_i);N=[]
n.times{N<<gets.chomp}
m.times{|i|!N[i].index(gets.chomp)?(puts :No;exit):m}
puts:Yes


nm = gets.chomp.split
n = nm[0].to_i
m = nm[1].to_i

a = []
n.times do
    a << gets.chomp
end

b = []
m.times do
    b << gets.chomp
end

result = false
n.times do |i|
    result = false
    if a[i].include?(b[0])
        result = true
        first = 0
        n.times do |j|
            if a[i].slice(j, m) == b[0]
                first = j
            end
        end

        (m - 1).times do |j|
            if !a[i + j + 1] || a[i + j + 1].slice(j, m) != b[j + 1]
                result = false
                break
            end
        end
    end
    break if result
end

puts result ? "Yes" : "No"


nm = gets.chomp.split
n = nm[0].to_i
m = nm[1].to_i

a = []
n.times do
    a << gets.chomp
end

b = []
m.times do
    b << gets.chomp
end

result = false
n.times do |i|
    result = false
    if a[i].include?(b[0])
        result = true
        first = 0
        n.times do |j|
            if a[i].slice(j, m) == b[0]
                first = j
            end
        end

        (m - 1).times do |j|
            if a[i + j + 1].slice(j, m) != b[j + 1]
                result = false
                break
            end
        end
    end
    break if result
end

puts result ? "Yes" : "No"


nm = gets.chomp.split
n = nm[0].to_i
m = nm[1].to_i

a = []
n.times do
    a << gets.chomp
end

b = []
m.times do
    b << gets.chomp
end

result = false
n.times do |i|
    result = false
    if a[i].include?(b[0])
        result = true
        first = 0
        n.times do |j|
            if a[i].slice(j, m) == b[0]
                first = j
            end
        end

        (m - 1).times do |j|
            if a[i + j + 1].slice(j, m) == b[j + 1]
                result = false
                break
            end
        end
    end
    break if result
end

puts result ? "Yes" : "No"


#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊

    let (n,m) = (io.read::<usize>(),io.read::<usize>());
    let mut A = Vec::new();
    let mut B = Vec::new();
    for _ in 0..n {
        let s = io.chars();
        A.push(s);
    }
    for _ in 0..m {
        let s = io.chars();
        B.push(s);}

    for i in 0..n-m+1 {
        for j in 0..n-m+1 {
            let mut ok = true;
            for ii in 0..m {
                for jj in 0..m {
                    if A[i+ii][j+jj] != B[ii][jj]{
                        ok=false;break;
                    }
                }
            }
            if ok {
                io.writeln("Yes");
                return;
            }
        }}

        io.writeln("No");

}

static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let m = it.next().unwrap().parse::<usize>().unwrap();
    let a = (0..n).map(|_| it.next().unwrap()).collect::<Vec<_>>();
    let b = (0..m).map(|_| it.next().unwrap()).collect::<Vec<_>>();
    let mut valid = false;
    for i in 0..n-m+1 {
        for j in 0..n-m+1 {
            let mut eq = true;
            for k in 0..m {
                if &a[i+k][j..j+m] != b[k] { eq = false; }
            }
            if eq { valid = true; }
        }
    }
    println!("{}", if valid { "Yes" } else { "No" });
}


#![allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

use nyan::*;

fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();

    let mut p1 = Vec::with_capacity(n);
    for _ in 0..n {
        let a: Vec<_> = sc.read_line();
        p1.push(a.into_iter().enumerate().fold(0usize, |acc, (i, c)| {
            if c == '#' {
                acc | (1usize << i)
            } else {
                acc
            }
        }));
    }

    let mut p2 = Vec::with_capacity(m);
    for _ in 0..m {
        let a: Vec<_> = sc.read_line();
        p2.push(a.into_iter().enumerate().fold(0usize, |acc, (i, c)| {
            if c == '#' {
                acc | (1usize << i)
            } else {
                acc
            }
        }));
    }

    for i in 0..n - m + 1 {
        for j in 0..n - m + 1 {
            let mut f = true;
            for k in 0..m {
                f = f && ((p1[i + k] >> j) ^ p2[k]) & (!0 >> (64 - m)) == 0;
            }
            if f {
                println!("Yes");
                return;
            }
        }
    }

    println!("No");
}

#[allow(dead_code)]
mod nyan {
    use std::cmp::Ordering;
    use std::fmt::{Debug, Display};
    use std::io;
    use std::iter::FromIterator;
    use std::str::FromStr;

    // https://doc.rust-lang.org/1.39.0/src/core/num/mod.rs.html#4473-4523
    #[inline]
    pub fn is_ascii_whitespace(c: char) -> bool {
        match c {
            '\t' | '\n' | '\x0C' | '\r' | ' ' => true,
            _ => false,
        }
    }

    #[inline]
    pub fn is_ascii_linebreak(c: char) -> bool {
        match c {
            '\n' | '\r' => true,
            _ => false,
        }
    }

    pub struct Scanner<R: io::BufRead> {
        reader: R,
        buffer: String,
        cursor: usize,
    }

    impl<R: io::BufRead> Scanner<R> {
        pub fn new(reader: R) -> Scanner<R> {
            Scanner {
                reader: reader,
                buffer: String::with_capacity(32),
                cursor: 0,
            }
        }

        fn next<F: Fn(char) -> bool>(&mut self, f: F) -> io::Result<&str> {
            loop {
                if let Some(l) = self.buffer[self.cursor..].find(|c| !is_ascii_whitespace(c)) {
                    self.cursor += l;
                    break;
                }

                self.buffer.clear();
                self.cursor = 0;
                match self.reader.read_line(&mut self.buffer) {
                    Err(e) => return Err(e),
                    Ok(0) => return Err(io::Error::from(io::ErrorKind::UnexpectedEof)),
                    _ => (),
                }
            }

            let start = self.cursor;
            self.cursor = self.buffer[self.cursor..]
                .find(f)
                .map_or(self.buffer.len(), |l| start + l);
            Ok(&self.buffer[start..self.cursor])
        }

        fn next_word(&mut self) -> io::Result<&str> {
            self.next(|c| is_ascii_whitespace(c))
        }

        fn next_line(&mut self) -> io::Result<&str> {
            self.next(|c| c == '\n' || c == '\r')
        }

        pub fn read<T>(&mut self) -> T
        where
            T: FromStr,
            <T as FromStr>::Err: Debug,
        {
            self.next_word().unwrap().parse().unwrap()
        }

        pub fn read_vec<T, U>(&mut self, n: usize) -> T
        where
            T: FromIterator<U>,
            U: FromStr,
            <U as FromStr>::Err: Debug,
        {
            (0..n).map(|_| self.read()).collect()
        }

        pub fn read_vec2d<T, U, V>(&mut self, m: usize, n: usize) -> T
        where
            T: FromIterator<U>,
            U: FromIterator<V>,
            V: FromStr,
            <V as FromStr>::Err: Debug,
        {
            (0..m).map(|_| self.read_vec(n)).collect()
        }

        pub fn read_line<T: FromIterator<char>>(&mut self) -> T {
            self.next_line().unwrap().chars().collect()
        }

        pub fn read_lines<T, U>(&mut self, n: usize) -> T
        where
            T: FromIterator<U>,
            U: FromIterator<char>,
        {
            (0..n).map(|_| self.read_line()).collect()
        }
    }

    #[test]
    fn test_scanner_next_word() {
        let buf = io::Cursor::new(b"hello world\nfoo\n\n\n\nbar\n");
        let mut r = Scanner::new(buf);

        assert_eq!(r.next_word().unwrap(), "hello");
        assert_eq!(r.next_word().unwrap(), "world");
        assert_eq!(r.next_word().unwrap(), "foo");
        assert_eq!(r.next_word().unwrap(), "bar");
        assert!(r.next_word().is_err());
        assert!(r.next_word().is_err());
    }

    #[test]
    fn test_scanner_next_line() {
        let buf = io::Cursor::new(b"hello world\nfoo\n\n\n\nbar\n");
        let mut r = Scanner::new(buf);

        assert_eq!(r.next_line().unwrap(), "hello world");
        assert_eq!(r.next_line().unwrap(), "foo");
        assert_eq!(r.next_line().unwrap(), "bar");
        assert!(r.next_line().is_err());
        assert!(r.next_line().is_err());
    }

    #[test]
    fn test_scanner_no_linebreak() {
        let buf = io::Cursor::new(b"hello world");
        let mut r = Scanner::new(buf);

        assert_eq!(r.next_word().unwrap(), "hello");
        assert_eq!(r.next_word().unwrap(), "world");
        assert!(r.next_word().is_err());
        assert!(r.next_word().is_err());
    }

    pub fn print_vec<T: Display>(v: &[T]) {
        if v.is_empty() {
            return;
        }

        print!("{}", v[0]);
        for i in v.iter().skip(1) {
            print!(" {}", i);
        }
        println!();
    }

    // C++ like binary search functions (upper_bound, lower_bound, equal_range)
    pub trait BinarySearch<T> {
        fn lower_bound(&self, value: &T) -> usize;
        fn upper_bound(&self, value: &T) -> usize;
        fn equal_range(&self, value: &T) -> (usize, usize) {
            (self.lower_bound(value), self.upper_bound(value))
        }
    }

    impl<T: Ord> BinarySearch<T> for [T] {
        // https://en.cppreference.com/w/cpp/algorithm/lower_bound#Possible_implementation
        fn lower_bound(&self, value: &T) -> usize {
            let mut first = 0;
            let mut last = self.len();
            while last != first {
                let mid = (first + last) / 2;
                match self[mid].cmp(value) {
                    Ordering::Less => first = mid + 1,
                    _ => last = mid,
                }
            }
            first
        }

        // https://en.cppreference.com/w/cpp/algorithm/upper_bound#Possible_implementation
        fn upper_bound(&self, value: &T) -> usize {
            let mut first = 0;
            let mut last = self.len();
            while last != first {
                let mid = (first + last) / 2;
                match self[mid].cmp(value) {
                    Ordering::Greater => last = mid,
                    _ => first = mid + 1,
                }
            }
            first
        }
    }

    #[test]
    pub fn test_binary_search() {
        let data = vec![1, 1, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6];
        assert_eq!(data.lower_bound(&4), 7);
        assert_eq!(data.upper_bound(&4), 10);
    }

    // https://doc.rust-lang.org/std/cmp/struct.Reverse.html
    #[derive(PartialEq, Eq, Debug)]
    pub struct Rev<T>(pub T);

    impl<T: PartialOrd> PartialOrd for Rev<T> {
        fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
            other.0.partial_cmp(&self.0)
        }
    }

    impl<T: Ord> Ord for Rev<T> {
        fn cmp(&self, other: &Self) -> Ordering {
            other.0.cmp(&self.0)
        }
    }

    // Extended Euclidean algorithm
    // ax + by = gcd(x, y)
    pub fn extended_gcd(a: u64, b: u64) -> (u64, i64, i64) {
        if b == 0 {
            (a, 1, 0)
        } else {
            let (m, y, x) = extended_gcd(b, a % b);
            (m, x, y - (a / b) as i64 * x)
        }
    }

    pub fn gcd(a: u64, b: u64) -> u64 {
        if b == 0 {
            a
        } else {
            gcd(b, a % b)
        }
    }

    pub fn lcm(a: u64, b: u64) -> u64 {
        a / gcd(a, b) * b
    }

    // x^n (mod p)
    pub fn pow_mod(mut x: u64, mut n: u64, p: u64) -> u64 {
        let mut r = 1;
        while n > 0 {
            if n & 1 > 0 {
                r *= x;
                r %= p;
            }
            x *= x;
            x %= p;
            n >>= 1;
        }
        r
    }

    #[test]
    fn test_pow_mod() {
        assert_eq!(pow_mod(4, 13, 497), 445);
        assert_eq!(pow_mod(2, 90, 13), 12);
        assert_eq!(pow_mod(2, 99999999, 147), 134);
    }

    // a^{p-1} = 1 (mod p) (Fermat's little theorem)
    // a^{p - 2} * a = 1 → a^{-1} = a^{p-2}
    pub fn inv_mod(n: u64, p: u64) -> u64 {
        pow_mod(n, p - 2, p)
    }

    // s * (s + 1) * .. * t (mod p)
    pub fn prod_mod(s: u64, t: u64, p: u64) -> u64 {
        (s..t + 1).fold(1, |acc, x| acc * x % p)
    }

    // nCk (mod p)
    pub fn comb_mod(n: u64, k: u64, p: u64) -> u64 {
        // nCk = n! / (k! * (n - k)!)
        //     = ((n-k+1) * (n-k+2) * ... * n) * inv(k!)
        prod_mod(n - k + 1, n, p) * inv_mod(prod_mod(1, k, p), p) % p
    }

    #[inline]
    pub fn minmax<T: Ord>(a: T, b: T) -> (T, T) {
        if a < b {
            (a, b)
        } else {
            (b, a)
        }
    }

    #[test]
    fn test_minmax() {
        assert_eq!(minmax(1, 3), (1, 3));
        assert_eq!(minmax(3, 1), (1, 3));
    }

    #[inline]
    pub fn digits(x: u64, base: u64) -> u32 {
        (1..)
            .find(|&i| base.pow(i - 1) <= x && x < base.pow(i))
            .unwrap_or(0)
    }

    #[test]
    fn test_digits() {
        assert_eq!(digits(1234, 10), 4);
        assert_eq!(digits(1234567890, 10), 10);
        assert_eq!(digits(0xdeadbeef, 16), 8);
        assert_eq!(digits(0o123456, 8), 6);
        assert_eq!(digits(0b10101, 2), 5);
    }

    pub struct UnionFind {
        n: usize,
        root: Vec<usize>,
        rank: Vec<usize>,
        size: Vec<usize>,
    }

    impl UnionFind {
        pub fn new(n: usize) -> UnionFind {
            UnionFind {
                n: n,
                root: (0..n).collect(),
                rank: vec![0; n],
                size: vec![1; n],
            }
        }

        pub fn root(&mut self, x: usize) -> usize {
            let r = self.root[x];
            if r == x {
                r
            } else {
                self.root[x] = self.root(r);
                self.root[x]
            }
        }

        pub fn merge(&mut self, x: usize, y: usize) {
            let rx = self.root(x);
            let ry = self.root(y);
            if rx == ry {
                return;
            }

            if self.rank[rx] < self.rank[ry] {
                self.root[rx] = ry;
                self.size[ry] += self.size[rx];
            } else {
                self.root[ry] = rx;
                self.size[rx] += self.size[ry];
                if self.rank[rx] == self.rank[ry] {
                    self.rank[rx] += 1;
                }
            }
        }

        pub fn size(&mut self, x: usize) -> usize {
            let rx = self.root(x);
            self.size[rx]
        }
    }
}


use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        a: [Chars;n],
        b: [Chars;m],
    }

    let mut ok: bool = true;
    for i in 0..n-m {
        for j in 0..n-m {
            debug!(i);
            for k in i..i+m {
                for l in j..j+m {
                    debug!(k);
                    debug!(a[k][l]);
                    // debug!(b[k][l]);
                    if a[k][l]==b[k-i][l-j] {
                        continue;
                    } else {
                        ok = false;
                        // break;
                    }
                }
            }
            debug!(ok);
            if ok {
                println!("Yes");
                return;
            }
            ok = true;
        }
    }
    println!("No");
}


use proconio::{fastout, input};
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        a: [String; n],
        b: [String; m]
    }
    let a = a.iter().map(|s| s.chars().collect()).collect();
    let b = b.iter().map(|s| s.chars().collect()).collect();
    let mut res = false;
    let diff = n - m;
    for x in 0..diff {
        for y in 0..diff {
            if check(x, y, &a, &b) {
                res = true;
            }
        }
    }
    println!("{}", if res { "Yes" } else { "No" })
}

fn check(sx: usize, sy: usize, a: &Vec<Vec<char>>, b: &Vec<Vec<char>>) -> bool {
    let m = b.len();
    for x in sx..sx + m {
        for y in sy..sy + m {
            if a[y][x] != b[y - sy][x - sx] {
                return false;
            }
        }
    }
    true
}


use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: usize,
        m: usize,
        a: [Chars; n],
        b: [Chars; m],
    }

    let mut exist = false;
    for ax in 0..n - m {
        for ay in 0..n - m {
            for bx in 0..m {
                let mut same = true;
                for by in 0..m {
                    if a[ax + bx][ay + by] != b[bx][by] {
                        same = false;
                    }
                }
                if same {
                    exist = true;
                }
            }
        }
    }
    if exist {
        println!("Yes");
    } else {
        println!("No");
    }
}


let input = readLine()!.split(separator: " ").map{ Int($0)! }
let N = input[0]
let M = input[1]

enum Color: Character {
    case white = "."
    case black = "#"
}

var A = [[Color]]()
var B = [[Color]]()

for _ in stride(from: 0, to: N, by: 1) {
    A.append(Array(readLine()!).map { Color(rawValue: $0)! })
}
for _ in stride(from: 0, to: M, by: 1) {
    B.append(Array(readLine()!).map { Color(rawValue: $0)! })
}

func solveB() -> Bool {
    for ix in stride(from: 0, through: N - M, by: 1) {
        for iy in stride(from: 0, through: N - M, by: 1) {
            var containsB = true
            B: for jx in stride(from: 0, to: M, by: 1) {
                for jy in stride(from: 0, to: M, by: 1) {
                    if A[ix + jx][iy + jy] != B[jx][jy] {
                        containsB = false
                        break B
                    }
                }
            }
            if containsB {
                return true
            }
        }
    }
    return false
}

print(solveB() ? "Yes" : "No")


import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, M) = (input[0], input[1])
let A = (0..<N).map{_ in readLine()!.toArray()}
let B = (0..<M).map{_ in readLine()!.toArray()}
var ans = "No"
loop1: for i in 0...N-M {
    for j in 0...N-M {
        var flag = true
        loop2: for y in 0..<M {
            for x in 0..<M {
                if B[y][x] != A[y+i][x+j] {
                    flag = false
                    break loop2
                }
            }
        }
        if flag {
            ans = "Yes"
            break loop1
        }
    }
}
print(ans)


#!/usr/bin/swift

import Foundation

let input = readLine()!.components(separatedBy: " ")
let N = Int(input[0])!
let M = Int(input[1])!

let A: [[String]] = (0..<N).map {
     _ in readLine()!.map { String($0) }
}
let B: [[String]] = (0..<M).map {
     _ in readLine()!.map { String($0) }
}

var isContained = false

for i in 0..<(N-M+1) {
    for j in 0..<(N-M+1) {
        var same = true
        for y in 0..<M {
            for x in 0..<M {
                if A[j+y][i+x] != B[y][x] {
                    same = false
                }
            }
        }

        if same == true {
            isContained = true
            break
        }
    }
}

if isContained {
    print("Yes")
} else {
    print("No")
}


import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

const main = (input: string): void => {
  const [nm, ...ab] = input.split("\n");
  const [n, m] = nm.split(" ");
  const N = parseInt(n, 10);
  const M = parseInt(m, 10);
  const A = ab.slice(0, N);
  const B = ab.slice(N, -1);
  let flag = false;
  let flag2 = false;

  A.forEach((a, i) => {
    const index = a.indexOf(B[0]);
    if (index !== -1) {
      if (N - i >= M) {
        for (let j = 1; j < M; j++) {
          const index2 = A[i + j].indexOf(B[j]);
          if (index === index2) flag = true;
          else flag = false;
        }
        if (flag || M === 1) flag2 = true;
      }
    }
  });

  if (flag2) console.log("Yes");
  else console.log("No");
};

main(input);


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let n=tn(),m=tn(),a=[],b=[],bb=[]
  for(let i=0;i<n;i++)a.push(ts().split(''))
  for(let i=0;i<m;i++)b.push(ts())
  let f=true
  for(let i=0;i<=n-m;i++){
    for(let j=0;j<=n-m;j++){
      let f=true
      for(let k=0;k<m;k++){
        if(a[i+k].slice(j,j+m).join('')!=b[k])f=false
      }
      if(f){
        to('Yes')
        return
      }
    }
  }
  to('No')
}
main()


import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, M] = input[0].map(Number);
  const A = input.slice(1, N + 1).map((line) => line[0]);
  const B = input.slice(N + 1, -1).map((line) => line[0]);

  for (let x = 0; x <= N - M; x++) {
    for (let y = 0; y <= N - M; y++) {
      let isMatched = true;

      for (let i = 0; i < M; i++) {
        if (B[i] !== A[y + i].slice(x, x + M)) {
          isMatched = false;
        }
      }

      if (isMatched) {
        return "Yes";
      }
    }
  }

  return "No";
};

console.log(main(read()));


import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

const main = (input: string): void => {
  const [nm, ...ab] = input.split("\n");
  const [n, m] = nm.split(" ");
  const N = parseInt(n, 10);
  const M = parseInt(m, 10);
  const A = ab.slice(0, N);
  const B = ab.slice(N, -1);
  let flag = false;
  let flag2 = false;

  console.log(N, M, A, B);

  A.forEach((a, i) => {
    const index = a.indexOf(B[0]);
    if (index !== -1) {
      if (N - i >= M) {
        for (let j = 1; j < M; j++) {
          const index2 = A[i + j].indexOf(B[j]);
          if (index === index2) flag = true;
          else flag = false;
        }
        if (flag || M === 1) flag2 = true;
      }
    }
  });

  if (flag2) console.log("Yes");
  else console.log("No");
};

main(input);


import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

const main = (input: string): void => {
  const [nm, ...ab] = input.split("\n");
  const [n, m] = nm.split(" ");
  const N = parseInt(n, 10);
  const M = parseInt(m, 10);
  const A = ab.slice(0, N);
  const B = ab.slice(N, -1);
  let flag = false;
  let flag2 = false;

  A.forEach((a, i) => {
    const index = a.indexOf(B[0]);
    if (index !== -1) {
      if (N - i - 1 >= M) {
        for (let j = 1; j < M; j++) {
          const index2 = A[i + j].indexOf(B[j]);
          if (index === index2) flag = true;
          else flag = false;
        }
        if (flag) flag2 = true;
      }
    }
  });

  if (flag2) console.log("Yes");
  else console.log("No");
};

main(input);


import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

const main = (input: string): void => {
  const [nm, ...ab] = input.split("\n");
  const [n, m] = nm.split(" ");
  const N = parseInt(n, 10);
  const M = parseInt(m, 10);
  const A = ab.slice(0, N);
  const B = ab.slice(N, -1);
  let flag = false;
  let flag2 = false;

  A.forEach((a, i) => {
    const index = a.indexOf(B[0]);
    if (index !== -1) {
      if (N - i >= M) {
        for (let j = 1; j < M; j++) {
          const index2 = A[i + j].indexOf(B[j]);
          if (index === index2) flag = true;
          else flag = false;
        }
        if (flag) flag2 = true;
      }
    }
  });

  if (flag2) console.log("Yes");
  else console.log("No");
};

main(input);


import sys
N = input()
for i in reversed(range(N + 1)):
    for j in reversed(range(7 + 1)):
        if i== 2 ** j:
            print i
            sys.exit(0)


import sys
N = input()
for i in reversed(range(7 + 1)):
    if 2 ** i <= N:
        print 2 ** i
        break


N = input()
print max ([2 ** i for i in range(8) if 2 ** i <= N])


N = int(input())
l = [1,2,4,8,16,32,64]{[::-1]
for i in l:
  if N >= i:
    print(i)
    break


n = int(input())
s = [i for i in range(1,n+1)]
counter = 0
while(True):
    if len([i for i in s if i % 2 == 0])==1:
        s = [i for i in s if i % 2 == 0]
        print(int(s[-1] * (2 ** counter)))
        break
    else:
        s = [i/2 for i in s]
        counter += 1


n = int(input())
ans = 0

for i in range(1, 7):
  if 2**i <= n:
    ans = 2**i

print(ans)


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int line = Integer.parseInt(br.readLine());

        if(line == 1){
            System.out.println(line);
        }
        else{
            int x = 1;
            for(; x <= line;){
                x = x * 2;
            }

            x = x / 2;
            System.out.println(x);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    BufferedReader rd;

    Main() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        out(Integer.highestOneBit(pint()));
    }

    private int pint() throws IOException {
        return pint(rd.readLine());
    }

    private int pint(String s) {
        return Integer.parseInt(s);
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }
}


import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        while(n >= 2){
            n/=2;
            cnt++;
        }
        System.out.println((int)Math.pow(2,cnt));
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}


    import java.util.*;

    public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);

            int N = sc.nextInt();

            int result = 0;
            int maxCount = 0;

            for(int i = 1; i <= N; i++){

                int count = 0;
                int num = i;

                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count > maxCount){
                    maxCount = count;
                    result = i;
                }
            }

            System.out.println(result);

        }

    }


import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        out.println(count(n));
        out.close();
        sc.close();
    }

    private static int count(int pnum) {
        int result = 0;
        for (int i = 0; (int) Math.pow(2, i) <= pnum; i++) {
            result = (int) Math.pow(2, i);
            System.out.println(result);
        }
        return result;
    }
}


package pracltice;

import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        out.println(count(n));
        out.close();
        sc.close();
    }

    private static int count(int pnum) {
        int result = 0;
        for (int i = 0; (int) Math.pow(2, i) <= pnum; i++) {
            result = (int) Math.pow(2, i);
            System.out.println(result);
        }
        return result;
    }
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
const int Max = 1e5;
const int MOD = 1e9 + 7;

int n;
int main()
{
	scanf("%d", &n);
	int sum = 1;
	for(int i = 1; i <= n; i++) {
		int ans = i;
		while(ans % 2 == 0 && ans != 1)
		{
			ans /= 2;
		}
		if(ans == 1) sum = max(i, sum);
	}
	printf("%d\n", sum);
	return 0;
}


#include<stdio.h>
int main(){

	int x;
scanf("%d",&x);
int s=1;
while(x>=s)
{s=s*2;
}
printf("%d\n",s/2);

}


#include<cstdio>
long long num[1001];
int main()
{
	int i=2;
	num[0]=2;
	for(i=1;i<=10;i++)
	{
		num[i]=num[i-1]*2;
	}
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<=10;i++)
		{
			if(num[i]>n) break;
		}
		if(n!=1) printf("%d\n",num[i-1]);
		else printf("1\n");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n ; cin>> n;
    if(n<=1) cout << 1 << endl;
    else if(n<=2) cout << 2 << endl;
    else if(n<=7) cout << 4 << endl;
    else if (n<=15) cout << 8 << endl;
    else if (n<=31) cout << 16 << endl;
    else if (n<=63) cout << 32 << endl;
    else cout << 64 << endl;
    return 0 ;
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define printl(s) cout << s << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;

const ll modSeed = pow(10,9) + 7;
const int INF = 1'000'000'000;

template <typename T>
vector<T> getVector(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
ll N,ans;

int main(){
  cin >> N;
  int maxCount = 0;
  for(int i=1;i<=N;i++){
    int val = i;
    int count =0;
    while(val%2==0){
      val /=2;
      count++;
    }
    if(count>maxCount){
      ans = i;
      maxCount = count;
    }
  }
  printl(ans);
}


/*
                IftekharMd.Shishir
                Dept. of Information and Communication Engineering
                University of Rajshahi
*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define ll  long long
#define ull  unsigned long long
#define ld  long double
#define f(i,n)  for(i=0;i<n;i++)
#define F(i,n)  for(i=n-1;i>=0;i--)
#define fa(i,a,b)  for(i=a;i<=b;i++)
#define Fa(i,a,b)  for(i=a;i>=b;i--)
#define printArray(i,a,n)  f(i,n)cout<<a[i]<<" "; cout<<endl;
#define printSet(a)  for(auto setData:a) cout<<setData<<" ";cout<<endl;
#define printMap(a)  for(auto mapData:a) cout<<mapData.first<<" "<<mapData.second<<endl;
#define printVector(a)  for(auto vectorData:a)cout<<vectorData<<" ";cout<<endl;
#define printLinkedList()  temp=head;while(temp){cout<<temp->data<<" ";temp=temp->post;} cout<<endl;

#define pb(x)  push_back(x)
#define all(a)  a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()

#define bs  binary_search
#define lb  lower_bound
#define ub  upper_bound
#define mp  make_pair
#define TxtIO  freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define TxtTest freopen("C:/Users/Iftekhar/Documents/what/input.txt", "r", stdin);
#define FastIO  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
#define TestCase  ll t;cin>>t;while(t--)
#define points(x)  fixed<<setprecision(x)
#define scd(a,x,y)  a/__gcd(x,y);
#define nl  cout<<endl;
#define done  return 0

const ld PI= 3.14159265358979323846264338327950288;  //2*acos(0.0);
const long long MOD= 1000000007;
const long long MAX = 32000;

// stringstream demo(str);  demo >> x;
// stringstream demo;  demo << x;  name=demo.str();

using namespace __gnu_pbds;
using namespace std;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main()
{
        FastIO;
        //TxtTest;
        ll n,i;
        cin>>n;
        if(n==1) {
                cout<<1<<endl;
                done;
        }
        ll a[7]={2,4,8,16,32,64,128};
        for(i=1;i<7;i++){
                if(n>=a[i] && n<a[i+1]){
                        cout<< a[i] <<endl;
                        done;
                }
        }
        done;
}


#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MOD 1000000007
#define ll long long

int main(){
    int n,i;
    scanf("%d",&n);
    i=1;
    while(2*i<=n){
        i*=2;
    }
    printf("%d\n",i);
    return 0;
}


#include <stdio.h>

int main(void)
{
	int n;
	scanf("%d", &n);

	int i;
	for (i = 1; i <= n; i *= 2);
	printf("%d\n", i/2);
	return 0;
}


#include <stdio.h>

int main(void){
    int N;
    scanf("%d", &N);

    if(N>=64){
        printf("64\n");
    }else if(N>=32){
        printf("32\n");
    }else if(N>=16){
        printf("16\n");
    }else if(N>=8){
        printf("8\n");
    }else if(N>=4){
        printf("4\n");
    }else if(N>=2){
        printf("2\n");
    }else{
        printf("1\n");
    }
}


#include <stdio.h>

int main(void){
int n,i = 0;
scanf("%d", &n);

for(i=1;i<=n;){
  i = 2*i;
  if((2*i)>n) break;
  //ans++;
}
printf("%d",i);
return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//qsort用 降順ソート
int comp(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}
int main(void)
{
    int N;
    int i;
    int ret = 0;
    scanf("%d",&N);
    if(N==1){
        printf("1\n");
        return 0;
    }
    // N以下の2の累乗を求める
    for(i=0;i<8;i++){
        if(pow(2,i)<N){
            ret = pow(2,i);
        }else{
            break;
        }
    }
    printf("%d\n",ret);
    return 0;
}


#include <stdio.h>
#include <math.h>

int main(void) {
  int input;
  fscanf(stdin, "%d", &input);

  // 2の累乗に最も近い値を選択
  for (int i = input; i > 0; i--) {
    printf("%d", i);
    if (log2(i) == 0.0 // 1
        || log2(i) == 1.0 // 2
        || log2(i) == 2.0 // 4
        || log2(i) == 3.0 // 8
        || log2(i) == 4.0 // 16
        || log2(i) == 5.0 // 32
        || log2(i) == 6.0 // 64
        ) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}


"use strict";

var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

function next() {
    return +cin[cid++];
} // number一個取得
function nextstr() {
    return cin[cid++];
} // 文字列一個取得
function nextbig() {
    return BigInt(cin[cid++]);
} // BigInteger一個取得
// 長さnの配列として取得。aは文字列フラグ
function nexts(n, a) {
    return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a);
}
// 長さnのBigInt配列として取得。
function nextsbig(n) {
    return cin.slice(cid, cid += n).map(a => BigInt(a));
}
// w個ずつを組にして長さhの配列。aは文字列フラグ。
function nextm(h, w, a) {
    var r = [],
        i = 0;
    if (a)
        for (; i < h; i++) r.push(cin.slice(cid, cid += w));
    else
        for (; i < h; i++) r.push(cin.slice(cid, cid += w).map(a => +a));
    return r;
}
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
function xArray(v) {
    var a = arguments,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
}

console.log(main().toString());

function main() {
    let n = next();
    let i;
    for (i = 1; i * 2 <= n; i = i * 2) {}
    return i
}


"use strict";

function Main(input) {
  const n = parseInt(input, 10);
  const nums = [64, 32, 16, 8, 4, 2, 1];

  const ans = nums.find(v => n >= v);
  console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict'

const main = input => {
	const n = parseInt(input.trim(), 10)
	let maxNum = 0
	let maxCnt = -1

	for (let i = 1; i <= n; i++) {
		let tmpNum = i
		let tmpCnt = 0

		while (true) {
			if (tmpNum % 2 === 1) break
			tmpNum /= 2
			tmpCnt++
		}

		if (tmpCnt > maxCnt) {
			maxNum = i
			maxCnt = tmpCnt
		}
	}

	console.log(maxNum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


function main(input) {
  const N = input;
  let n = 0;

  // Math.pow(x, y) xのy乗

  while(true) {
  	if (Math.pow(2, n) < N) {
      n++;
    } else if (Math.pow(2, n) === N) {
      break;
    } else {
      //一回分多くたされているから引く
      n--;
      break;
    }
  }

  console.log(Math.pow(2, n));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input) {
  input = input * 1;
  let biggest = 0;
  let biggestId = 0;
  for (let i = 1;i <= input;i++) {
    let nowNum = i;
    let count = 0;
    while (nowNum % 2 === 0) {
      nowNum = nowNum / 2;
      count++;
    }
    if (biggest < count) {
      biggest = count;
      biggestId = i;
    }
  }
  console.log(biggestId);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input) {
  input = input * 1;
  let biggest = 0;
  let biggestId = 0;
  for (let i = 0;i < input;i++) {
    let nowNum = i;
    let count = 0;
    while (nowNum % 2 === 0 && nowNum !== 0) {
      nowNum = nowNum / 2;
      count++;
    }
    if (biggest < count) {
      biggest = count;
      biggestId = i;
    }
  }
  console.log(biggestId);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	var N int
	if scanner.Scan() {
		str := scanner.Text()
		N, _ = strconv.Atoi(str)
	}
	s := fmt.Sprintf("%b", N)
	//fmt.Printf("%b\n", N)
	ans := len(s) - 1
	p := math.Pow(2, float64(ans))
	fmt.Fprintln(wtr, int(p))
	_ = wtr.Flush()
}

func max(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a int, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}


package main

// Solution for https://atcoder.jp/contests/abc068/tasks/abc068_b

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	m := n
	for i := 2; i <= n; i <<= 1 {
		m = i
	}
	con.Println(m)
	return nil
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	if n == 1 {
		fmt.Println(1)
	}else if n >= 2 && n < 4{
		fmt.Println(2)
	}else if n >= 4 && n < 8{
		fmt.Println(4)
	}else if n >= 8 && n < 16{
		fmt.Println(8)
	}else if n >= 16 && n < 32{
		fmt.Println(16)
	}else if n >= 32 && n < 64{
		fmt.Println(32)
	}else if n >= 64 && n <= 100{
		fmt.Println(64)
	}
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	// sc.Buffer([]byte{}, math.MaxInt64)
	// a := make([][]int, 3)
	// for i := 0; i < 3; i++ {
	// 	a[i] = make([]int, 3)
	// }
	// for i := 0; i < 3; i++ {
	// 	for j := 0; j < 3; j++ {
	// 		a[i][j] = nextInt()
	// 	}
	// }

	n := nextInt()

	var out int
	var ans int

	for i := 1; i <= n; i++ {
		if i%2 == 0 {
			cnt := 0
			for j := i; j%2 == 0; {
				j = j / 2
				cnt++
			}
			if cnt > out {
				out = cnt
				ans = i
			}
		}
	}

	fmt.Println(ans)

}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	res, cnt := 0, 0
	for i := 1; i <= n; i++ {
		t, c := i, 0
		for t % 2 == 0 {
			t /= 2
			c += 1
		}
		if cnt < c {
			res = i
			cnt = c
		}
	}

	fmt.Println(res)
}


package main

import (
  "fmt"
)
func main() {
  var N int
  fmt.Scan(&N)

  ans := 1
  for ans * 2 <= N {
   ans *= 2
   fmt.Println(ans)
  }
  fmt.Println(ans)
}


N=gets.to_i

ret = 1
while ret <= N
    ret *= 2
end

puts ret/2


def mydiv(n, cnt=0)
    n % 2 == 0 ? mydiv(n.div(2), cnt.next) : cnt
end
N = gets.to_i
max_cnt = 0
max_n = 1
1.upto(N) do |n|
    cnt = mydiv(n)
    if max_cnt < cnt
        max_cnt = cnt
        max_n = n
    end
end
puts max_n


n = gets.to_i
puts 2 ** Math::log2(n).to_i


def create_array(n,ary)
  return ary[n] = 1 if n == 0
  ary[n] = create_array(n-1,ary)*2
  ary[n]
end
ary = []
create_array(7,ary)
ary.each_cons(2) {|a,b| puts a if (a...b).include?(n)}


n = gets.chomp.to_i

if n % 2 == 0
  print n
else
  print n - 1
end


n = gets.to_i
max = 0
maxCnt = 0

(1..n).each do |val|
    tmpCnt = 0
    if val.odd?
        next
    else
        calcVal = val
        while calcVal.even?
            calcVal /= 2
            tmpCnt += 1
        end
    end

    if tmpCnt > maxCnt
        maxCnt = tmpCnt
        max = val
    end
end

puts max


//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);

    let mut m = 0;
    let mut m_x = 0;

    for x in 1..N + 1 {
        let mut k = 0;
        let mut y = x;
        while y >= 2 && y % 2 == 0 {
            y /= 2;
            k += 1;
        }
        if m <= k {
            m = k;
            m_x = x;
        }
    }

    println!("{}", m_x)
}


use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    println!(
        "{}",
        if 2 > n {
            1
        } else if 4 > n {
            2
        } else if 8 > n {
            4
        } else if 16 > n {
            8
        } else if 32 > n {
            16
        } else if 64 > n {
            32
        } else {
            64
        }
    )
}


use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let upper = buf.trim().parse::<i32>().unwrap();

    let mut pow2 = 1;
    if upper == 1{
        println!("1");
    } else {
        while pow2 <= upper {
            pow2 *= 2;
        }
        println!("{}", pow2 / 2);
    }
}


fn main() {
    let n: usize = read();
    let mut ans = 0;
    let mut max = 0;
    for i in 1..n+1 {
        let mut s = 0;
        for x in 1..7 {
            if 2_i32.pow(x) <= (i as i32) {
                s = x;
            } else {
                break
            }
        }
        if max < s {
            max = s;
            ans = i;
        }
    }
    println!("{}", ans);
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn xx(i:usize) -> i32 {
    if i % 2 == 0 && i != 0 {
        return xx(i / 2) + 1;
    } else {
        return 0;
    }
}
fn main() {
    /*     input! {
        n: usize,
        mut plan: [(i32, i32, i32); n],  // Vec<(i32, i32, i32)>
    }
 */
    input! {
        n:usize,
    }
    let mut ans = 0;
    let mut cnt = 0;
    for i in (0..n+1).filter(|x|x % 2 == 0){
        let cur_cnt = xx(i);
        if cnt < cur_cnt {
            ans = i;
            cnt = cur_cnt;
        }
    }
    println!("{}",ans);
}


use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut ans: usize = 1;
    if n == 0 {
        println!("1");
        return;
    }
    while ans < n {
        ans *= 2;
    }
    println!("{}", ans / 2);
}


let s = Int(readLine()!)!
var a = 1
while s >= a {
    a *= 2
}

print(a/2)


#if os(OSX) || os(iOS)
    import Darwin
#elseif os(Linux)
    import Glibc
#endif
print(1 << Int(floor(log2(Double(readLine()!)!))))


import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

/*************** メインプログラム ***************/

let N = readInt()!
var ans = 0
if N < 2 {
    ans = 1
} else if N < 4 {
    ans = 2
} else if N < 8 {
    ans = 4
} else if N < 16 {
    ans = 8
} else if N < 32 {
    ans = 16
} else if N < 64 {
    ans = 32
} else {
    ans = 64
}
print(ans)


import Foundation
var s = [Int]()
for i in 1 ..< 10 {
    var a = Int(pow(2, Double(i)))
    s.append(a)
}

let a = Int(readLine()!)!

var num = 0
while a >= s[num] {
    num += 1
}
print(s[num-1])


let s = 90
var a = 1
while s >= a {
    a *= 2
}

println(a/2)


const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const gojo=(a:number,b:number):number=>{if(a%b===0)return b;return gojo(b,a%b)};const deduplicate=(a:number[])=>{return Array.from(new Set(a))};
const main=()=>{
  let n=tn(),index=0,ma=0
  for(let i=1;i<=n;i++){
    let m=i,c=0
    while(m%2==0&&m!=0){
      m/=2
      c++
    }
    if(ma<=c){
      index=i
      ma=c
    }
  }
  to(index)
}
main()


"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N =Number(xs[0]);
   let ans = 0;
   for(let i=1; i<=N; i++){
   	 ans = Math.pow(2,i);
     if(N==1){
     ans = 1;
     break;
     }else if(ans>N){
        ans =Math.pow(2,i-1)
        break;
     }
   }
   console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


const log = console.log;

const findFirstSet = (bits: number): number | null => {
  for (let i = 0; i < 64; i += 1) {
    if ((bits & 1) === 1) return i;
    bits >>>= 1;
  }

  return null;
};

// ----

function Main(input: string): void {
  const n = parseInt(input);

  let maxDivisionCount = 0;
  let answer = 1;

  for (let i = 1; i <= n; i += 1) {
    const divisionCount = findFirstSet(i);

    if (!divisionCount || maxDivisionCount > divisionCount) continue;

    maxDivisionCount = divisionCount;
    answer = i;
  }

  log(answer);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N =Number(xs[0]);
   let ans = 0;
   for(let i=1; i<=N; i++){
   	 ans = Math.pow(2,0);
     if(N==1){
     ans = 1;
     break;
     }else if(ans>N){
        ans =Math.pow(2,i-1)
        break;
     }
   }
   console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N =Number(xs[0]);
   let ans = 0;
   for(let i=1; i<N; i++){
   	 ans = Math.pow(2,i);
     if(ans>N){
        ans =Math.pow(2,i-1)
        break;
     }
   }
   console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N =xs[0];
   let ans = 0;
   for(let i=1; i<7; i++){
   	 ans = Math.pow(2,i);
     if(ans>N){
        ans =Math.pow(2,i-1)
        return;
     }
   }
   console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


import sys
from bisect import bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

def main():
    N, *A = map(int, read().split())

    dp = [A[-1]]
    for a in reversed(A[:-1]):
        if a >= dp[-1]:
            dp.append(a)
        else:
            dp[bisect_right(dp, a)] = a

    print(len(dp))
    return

if __name__ == '__main__':
    main()


def main():
    import sys
    import bisect

    read = sys.stdin.buffer.read
    bisect_right = bisect.bisect_right

    N, *A = map(int, read().split())

    dp = [A[-1]]
    for a in reversed(A[:-1]):
        if a >= dp[-1]:
            dp.append(a)
        else:
            dp[bisect_right(dp, a)] = a

    print(len(dp))
    return

if __name__ == '__main__':
    main()


import sys
from bisect import bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

def main():
    N, *A = map(int, read().split())

    vec = [A[-1]]
    for a in reversed(A[:-1]):
        if a >= vec[-1]:
            vec.append(a)
        else:
            vec[bisect_right(vec, a)] = a

    print(len(vec))
    return

if __name__ == '__main__':
    main()


import bisect
def get_LIS(seq):
    LIS = [seq[0]]
    for i in range(1,len(seq)):
        if seq[i] >= LIS[-1]:
            LIS.append(seq[i])
        else:
            LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]

    print(len(LIS))

N = int(input())
A = [int(input()) for _ in range(N)]
A = A[::-1]
get_LIS(A)


from bisect import *

def LIS(N, A):
    L = [0 for i in range(N+1)]
    L[0] = A[0]
    length = 1
    for i in range(1, N):
        if L[length-1] <= A[i]:
            # 最長を更新できる場合
            L[length] = A[i]
            length += 1
        else:
            # L にA[i]が入る場所を二分探索
            index = bisect_left(L, A[i], 0, length)
            L[index] = A[i]
    return length

N = int(input())
A = [int(input()) for _ in range(N)]
A = A[::-1]
print(LIS(N, A))


import sys
from bisect import bisect_left

def bisect_left_reverse(a, x):
    '''
    reverseにソートされたlist aに対してxを挿入できるidxを返す。
    xが存在する場合には一番左側のidxとなる。
    '''
    if a[0] <= x:
        return 0
    if x < a[-1]:
        return len(a)
    # 二分探索
    ok = len(a) - 1
    ng = 0
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if a[mid] <= x:
            ok = mid
        else:
            ng = mid
    return ok

input = sys.stdin.readline
N = int(input())
A = []
for _ in range(N):
	A.append(int(input()))

multi_lis = []
for a_i in A:
    if not multi_lis:
        multi_lis.append(a_i)
        continue

    if a_i <= multi_lis[-1]:
        multi_lis.append(a_i)
    else:
        p = bisect_left_reverse(multi_lis, a_i)
        multi_lis[p] = a_i

print(len(multi_lis))


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author gaidash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ESequenceDecomposing solver = new ESequenceDecomposing();
        solver.solve(1, in, out);
        out.close();
    }

    static class ESequenceDecomposing {
        private int binarySearch(int[] a, int right, int key) {
            int left = -1;
            while (left + 1 < right) {
                int mid = (left + right) / 2;
                if (a[mid] >= key) left = mid;
                else right = mid;
            }
            return right;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();

            int[] color = new int[n];
            int size = 0;
            for (int i = 0; i < n; i++) {
                int insert = binarySearch(color, size, a[i]);
                if (insert == size) color[size++] = a[i];
                else color[insert] = a[i];
            }

            out.println(size);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author gaidash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ESequenceDecomposing solver = new ESequenceDecomposing();
        solver.solve(1, in, out);
        out.close();
    }

    static class ESequenceDecomposing {
        private int ceilBinarySearch(int[] a, int right, int key) {
            int left = -1;
            while (left + 1 < right) {
                int mid = (left + right) / 2;
                if (a[mid] >= key) left = mid;
                else right = mid;
            }
            return right;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();

            int[] color = new int[n];
            int size = 0;
            for (int i = 0; i < n; i++) {
                int insert = ceilBinarySearch(color, size, a[i]);
                if (insert == size) color[size++] = a[i];
                else color[insert] = a[i];
            }

            out.println(size);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}