#C11625. Sheep Escape

    ID: 40962 Type: Default 1000ms 256MiB

Sheep Escape

Sheep Escape

You are given a grid of size \(N\times N\) along with \(S\) sheep and \(W\) wolves positioned on it. Each sheep and each wolf occupies a cell on the grid by their integer coordinates. A sheep is considered caught if it occupies the same cell as any wolf; otherwise, it escapes.

Your task is to determine whether all sheep can escape or if at least one sheep is caught. Although in a more complex variant you might consider movement and path finding, in this problem the check is simplified to comparing positions.

Input Format: The input is provided via standard input. The first line contains three space-separated integers \(N\), \(S\), and \(W\). The following \(S\) lines each contain two integers representing the coordinates of a sheep. After that, there are \(W\) lines, each with two integers representing the coordinates of a wolf.

Output Format: Print a single word to standard output: ESCAPED if none of the sheep share a cell with any wolf, or CAUGHT if at least one sheep is on the same cell as a wolf.

inputFormat

The first line contains three space-separated integers \(N\), \(S\), \(W\), where \(N\) is the grid size, \(S\) is the number of sheep, and \(W\) is the number of wolves. Following this, there are \(S\) lines, each with two space-separated integers representing the row and column coordinates of a sheep. Finally, there are \(W\) lines, each with two space-separated integers representing the row and column coordinates of a wolf.

Input is read from standard input (stdin).

outputFormat

Output a single line to standard output (stdout) containing the word ESCAPED if all sheep are safe, or CAUGHT if any sheep is in the same position as a wolf.

## sample
5 2 2
2 2
4 4
1 1
5 5
ESCAPED