human
Alice has written a program and now tries to improve its readability. One of the ways to improve readability is to give sensible names to the variables, so now Alice wants to rename some variables in her program. In her IDE there is a command called "massive refactoring", which can replace names of many variable in just one run. To use it, Alice needs to select two strings s and t and after that for each variable the following algorithm is performed: if the variable's name contains s as a substring, then the first (and only first) occurrence of s is replaced with t. If the name doesn't contain s, then this variable's name stays the same.

The list of variables is known and for each variable both the initial name and the name Alice wants this variable change to are known. Moreover, for each variable the lengths of the initial name and the target name are equal (otherwise the alignment of the code could become broken). You need to perform renaming of all variables in exactly one run of the massive refactoring command or determine that it is impossible.

Input

The first line contains the only integer n (1 ≤ n ≤ 3000) — the number of variables in Alice's program.

The following n lines contain the initial names of variables w_1, w_2, …, w_n, one per line. After that, n more lines go, the i-th of them contains the target name w'_i for the i-th variable. It is guaranteed that 1 ≤ |w_i| = |w'_i| ≤ 3000.

It is guaranteed that there is at least one variable having its target name different from the initial name. Both initial and target names consist of lowercase English letters only. For each variable the length of its initial name is equal to the length of its target name.

Output

If it is impossible to rename all variables with one call of "massive refactoring", print "NO" (quotes for clarity).

Otherwise, on the first line print "YES" (quotes for clarity) and on the following lines print s and t (1 ≤ |s|, |t| ≤ 5000), which should be used for replacement. Strings s and t should consist only of lowercase letters...
Solve the task in PYTHON.

=====
Give me a Python code to determine that it is impossible?
assistant
#Here is Python code to determine that it is impossible.

from __future__ import division
from fileinput import input
from itertools import izip

class KMP:
    def __init__(self, pattern):
        self.pattern = pattern

    def KnuthMorrisPratt(self, text):
        '''Yields all starting positions of copies of the pattern in the text.
    Calling conventions are similar to string.find, but its arguments can be
    lists or iterators, not just strings, it returns all matches, not just
    the first one, and it does not need the whole text in memory at once.
    Whenever it yields, it will have read the text exactly up to and including
    the match that caused the yield.'''

        # build table of shift amounts
        shifts = [1] * (len(self.pattern) + 1)
        shift = 1
        for pos in range(len(self.pattern)):
            while shift <= pos and self.pattern[pos] != self.pattern[pos-shift]:
                shift += shifts[pos-shift]
            shifts[pos+1] = shift

        # do the actual search
        startPos = 0
        matchLen = 0
        for c in text:
            while matchLen == len(self.pattern) or \
                  matchLen >= 0 and self.pattern[matchLen] != c:
                startPos += shifts[matchLen]
                matchLen -= shifts[matchLen]
            matchLen += 1
            if matchLen == len(self.pattern):
                return startPos
        return -1

def alleq(li):
    for c in li[1:]:
        if c != li[0]:
            return False
    return True

def mkst(r):
    out = ""
    for c in r:
        out += c
    return out

def solve():
    inp = input()
    n = int(inp.readline())
    fro = []
    for _ in xrange(n):
        line = inp.readline().rstrip("\n")
        fro.append(line)
    to = []
    for _ in xrange(n):
        line = inp.readline().rstrip("\n")
        to.append(line)

    changefrom = ""
    changeto = ""
    nochange = []
    changearr = []
    fronts = []
    backs = []
    for f, t in zip(fro, to):
        errors = -1
        errore = -1
        for i in xrange(len(f)):
            if f[i] !=...