[ABC351B] 矩阵找茬 (Spot the Difference)
Score: points
Problem Statement
You are given two grids, each with rows and columns, referred to as grid and grid .
Each cell in the grids contains a lowercase English letter.
The character at the -th row and -th column of grid is .
The character at the -th row and -th column of grid is .
The two grids differ in exactly one cell. That is, there exists exactly one pair of positive integers not greater than such that . Find this .
Constraints
-
-
and are all lowercase English letters.
-
There exists exactly one pair such that .
Input
The input is given from Standard Input in the following format:
$N$
$A_{1,1}A_{1,2}\dots A_{1,N}$
$A_{2,1}A_{2,2}\dots A_{2,N}$
$\vdots$
$A_{N,1}A_{N,2}\dots A_{N,N}$
$B_{1,1}B_{1,2}\dots B_{1,N}$
$B_{2,1}B_{2,2}\dots B_{2,N}$
$\vdots$
$B_{N,1}B_{N,2}\dots B_{N,N}$
Output
Let be the pair of positive integers not greater than such that . Print in the following format:
$i$ $j$
Sample Input 1
3
abc
def
ghi
abc
bef
ghi
Sample Output 1
2 1
From d and b, we have , so satisfies the condition in the problem statement.
Sample Input 2
1
f
q
Sample Output 2
1 1
Sample Input 3
10
eixfumagit
vtophbepfe
pxbfgsqcug
ugpugtsxzq
bvfhxyehfk
uqyfwtmglr
jaitenfqiq
acwvufpfvv
jhaddglpva
aacxsyqvoj
eixfumagit
vtophbepfe
pxbfgsqcug
ugpugtsxzq
bvfhxyehok
uqyfwtmglr
jaitenfqiq
acwvufpfvv
jhaddglpva
aacxsyqvoj
Sample Output 3
5 9