codeforces#P1055D. Refactoring

Refactoring

Description

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 ss and tt and after that for each variable the following algorithm is performed: if the variable's name contains ss as a substring, then the first (and only first) occurrence of ss is replaced with tt. If the name doesn't contain ss, 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.

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

The following nn lines contain the initial names of variables w1,w2,,wnw_1, w_2, \ldots, w_n, one per line. After that, nn more lines go, the ii-th of them contains the target name wiw'_i for the ii-th variable. It is guaranteed that 1wi=wi30001 \le |w_i| = |w'_i| \le 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.

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 ss and tt (1s,t50001 \le |s|, |t| \le 5000), which should be used for replacement. Strings ss and tt should consist only of lowercase letters of English alphabet.

If there are multiple ways to perform a "massive refactoring", you can use any of them.

Input

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

The following nn lines contain the initial names of variables w1,w2,,wnw_1, w_2, \ldots, w_n, one per line. After that, nn more lines go, the ii-th of them contains the target name wiw'_i for the ii-th variable. It is guaranteed that 1wi=wi30001 \le |w_i| = |w'_i| \le 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 ss and tt (1s,t50001 \le |s|, |t| \le 5000), which should be used for replacement. Strings ss and tt should consist only of lowercase letters of English alphabet.

If there are multiple ways to perform a "massive refactoring", you can use any of them.

Samples

输入数据 1

1
topforces
codecoder

输出数据 1

YES
topforces
codecoder

输入数据 2

3
bab
cac
cdc
bdb
cdc
cdc

输出数据 2

YES
a
d

输入数据 3

2
you
shal
not
pass

输出数据 3

NO