#abc216b. B - Same Name

B - Same Name

Score : 200200 points

问题描述

NN 个人。第 ii 个(1iN1 \leq i \leq N)人的姓氏和名字分别为 SiS_iTiT_i

判断是否存在一对人具有相同的姓氏和名字。换句话说,判断是否存在一对整数 (i,j)(i,j) 满足 1i<jN1 \leq i < j \leq N,且 Si=SjS_i=S_j 以及 Ti=TjT_i=T_j

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

There are NN people. The family name and given name of the ii-th person (1iN)(1 \leq i \leq N) are SiS_i and TiT_i, respectively.

Determine whether there is a pair of people with the same family and given names. In other words, determine whether there is a pair of integers (i,j)(i,j) such that 1i<jN1 \leq i \lt j \leq N, Si=SjS_i=S_j, and Ti=TjT_i=T_j.

Constraints

  • 2N10002 \leq N \leq 1000
  • NN is an integer.
  • Each of SiS_i and TiT_i is a string of length between 11 and 1010 (inclusive) consisting of English lowercase letters.

Input

Input is given from Standard Input in the following format:

NN

S1S_1 T1T_1

S2S_2 T2T_2

\hspace{0.6cm}\vdots

SNS_N TNT_N

Output

If there is a pair of people with the same family and given names, print Yes; otherwise, print No.

Sample Input 1

3
tanaka taro
sato hanako
tanaka taro

Sample Output 1

Yes

The first and third persons have the same family and given names.

Sample Input 2

3
saito ichiro
saito jiro
saito saburo

Sample Output 2

No

No two persons have the same family and given names.

Sample Input 3

4
sypdgidop bkseq
bajsqz hh
ozjekw mcybmtt
qfeysvw dbo

Sample Output 3

No

update @ 2024/3/10 09:34:36