#K43122. Detect Revisiting of Locations

    ID: 27240 Type: Default 1000ms 256MiB

Detect Revisiting of Locations

Detect Revisiting of Locations

You are provided with tracking data of a moving object in a 2-dimensional plane. The data is given as a list of integers. The first integer \(N\) indicates the number of locations visited. This is followed by \(2N\) integers representing the x and y coordinates of each location in the order they were visited.

Your task is to determine whether the object visited any location more than once. In other words, check if there exists any pair \((x, y)\) that appears at least twice in the sequence of locations.

If a location is revisited, print YES; otherwise, print NO.

Input Format:

  • The first line contains the integer \(N\) (the number of locations).
  • The second line contains \(2N\) space-separated integers. The \(i\)-th pair represents the coordinates \((x_i, y_i)\).

Output Format:

  • Output a single line containing YES if any location is revisited, or NO otherwise.

inputFormat

The input is read from the standard input (stdin) and it follows the format below:

N
x1 y1 x2 y2 ... xN yN

where \(N\) is the number of locations and each pair \((x_i, y_i)\) represents a coordinate.

outputFormat

The output should be printed to the standard output (stdout) as a single line. Print YES if there is at least one coordinate that appears more than once; otherwise, print NO.

## sample
5
1 2 3 4 1 2 5 6 7 8
YES