#K1801. Multiple Pending Friend Requests

    ID: 24595 Type: Default 1000ms 256MiB

Multiple Pending Friend Requests

Multiple Pending Friend Requests

You are given n friend requests. Each friend request is represented by an ordered pair \((x, y)\), which indicates that user x sent a friend request to user y. Your task is to determine if there exists at least one user who has more than one pending friend request. Formally, let \(n\) be the number of friend requests and let the list of requests be \(R = [(x_1,y_1), (x_2,y_2), \dots, (x_n,y_n)]\). You need to check if there exists a user \(y\) such that the count of \(y\) in the list is at least 2. If such a user exists, print "YES"; otherwise, print "NO".

inputFormat

The input is read from standard input and has the following format:

 n
 x1 y1
 x2 y2
 ...
 xn yn

Here, n is an integer representing the number of friend requests. The following n lines each contain two integers x and y, where \(x\) is the sender and \(y\) is the receiver.

outputFormat

Output a single line to standard output containing either "YES" if any user receives more than one friend request, or "NO" otherwise.

## sample
4
1 2
2 3
1 4
4 2
YES

</p>