from collections import deque class Node: def __init__(self): self.children = {} self.back = None def step(self, ch): n = self while n.back != n and ch not in n.children: n = n.back return n.children.get(ch, n) def step(query, table, s, n): while query[s] != n and s > 0: s = table[s] if query[s] == n: s = s + 1 return s N, K = map(int, input().split()) big = [] small = [] for i in range(N): big.append(input()) for i in range(K): small.append(input()) trie = Node() query = [] for i in range(K): n = trie for ch in small[i]: if ch not in n.children: n.children[ch] = Node() n = n.children[ch] query.append(n) query.append(None) trie.back = trie q = deque() for n in trie.children.values(): n.back = trie q.append(n) while q: p = q.popleft() for ch, n in p.children.items(): n.back = p.back.step(ch) q.append(n) ends = [] for i in range(N): n = trie row = [] for j in range(N): row.append(n := n.step(big[i][j])) ends.append(row) table = [None, 0] s = 0 for i in range(2, K + 1): table.append(s := step(query, table, s, query[i - 1])) for j in range(K - 1, N): s = 0 for i in range(N): s = step(query, table, s, ends[i][j]) if s == K: print(i - K + 1, j - K + 1)