Alan is taking the bus!

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Alan lives in a strange neighbourhood with N houses. In this neighbourhood, there are M buses. Each of these buses can only ever travel between two select houses.

Since Alan likes to complain about his bus routes and will start complaining if he has to take more than two buses, help us determine if he can travel between two houses without complaint.

Input Specification

The first line will contain two integers, separated by spaces:

  • N (1 \leq N \leq 5000): The number of houses in the neighbourhood.
  • M (0 \leq M \leq N): The number of buses in the neighbourhood.

The next M lines will contain two integers separated by spaces, A and B (1 \leq A, B \leq N), denoting that there is a bus connecting house A to house B. The buses are two-directional (they can travel from A to B and from B to A). There will never be a bus connecting the same house.

The next line will contain two integers, X and Y (1 \leq X, Y \leq N), denoting the two houses that Alan wants to travel between.

Output Specification

On a single line, print yay! no complaint. if Alan can travel between the two houses using at most two buses. Otherwise, print aww man! whiny Alan..

Sample Input 1

3 2
1 2
2 3
1 3

Sample Output 1

yay! no complaint.

Sample Input 2

3 1
1 2
1 3

Sample Output 2

aww man! whiny Alan.

Comments

There are no comments at the moment.