#abc351b. B - Spot the Difference

B - Spot the Difference

Score: 150150 points

问题陈述

给定两个网格,每个网格都有 NN 行和 NN 列,分别称为网格 AA 和网格 BB。 网格中的每个单元格都包含一个小写英文字母。 网格 AA 中第 ii 行第 jj 列的字符是 Ai,jA_{i, j}。 网格 BB 中第 ii 行第 jj 列的字符是 Bi,jB_{i, j}

这两个网格在一个单元格上不同。也就是说,存在唯一的一对正整数 (i,j)(i, j),且这对整数不超过 NN,使得 Ai,jBi,jA_{i, j} \neq B_{i, j}。找到这个 (i,j)(i, j)

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given two grids, each with NN rows and NN columns, referred to as grid AA and grid BB.
Each cell in the grids contains a lowercase English letter.
The character at the ii-th row and jj-th column of grid AA is Ai,jA_{i, j}.
The character at the ii-th row and jj-th column of grid BB is Bi,jB_{i, j}.

The two grids differ in exactly one cell. That is, there exists exactly one pair (i,j)(i, j) of positive integers not greater than NN such that Ai,jBi,jA_{i, j} \neq B_{i, j}. Find this (i,j)(i, j).

Constraints

  • 1N1001 \leq N \leq 100
  • Ai,jA_{i, j} and Bi,jB_{i, j} are all lowercase English letters.
  • There exists exactly one pair (i,j)(i, j) such that Ai,jBi,jA_{i, j} \neq B_{i, j}.

Input

The input is given from Standard Input in the following format:

NN

A1,1A1,2A1,NA_{1,1}A_{1,2}\dots A_{1,N}

A2,1A2,2A2,NA_{2,1}A_{2,2}\dots A_{2,N}

\vdots

AN,1AN,2AN,NA_{N,1}A_{N,2}\dots A_{N,N}

B1,1B1,2B1,NB_{1,1}B_{1,2}\dots B_{1,N}

B2,1B2,2B2,NB_{2,1}B_{2,2}\dots B_{2,N}

\vdots

BN,1BN,2BN,NB_{N,1}B_{N,2}\dots B_{N,N}

Output

Let (i,j)(i, j) be the pair of positive integers not greater than NN such that Ai,jBi,jA_{i, j} \neq B_{i, j}. Print (i,j)(i, j) in the following format:

ii jj

Sample Input 1

3
abc
def
ghi
abc
bef
ghi

Sample Output 1

2 1

From A2,1=A_{2, 1} = d and B2,1=B_{2, 1} = b, we have A2,1B2,1A_{2, 1} \neq B_{2, 1}, so (i,j)=(2,1)(i, j) = (2, 1) 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