Asking for Money
면접 대비시간 제한0.5초메모리 제한1024 MB
N명이 각각 한 번만 요청을 받으면 미리 정해진 두 사람에게 1달러를 요구할 때, 어떤 순서로 요청이 진행되면 손해를 볼 수 있는 사람을 모두 찾는다.
문제
The International Commission for the Prevention of Cons is studying the possible effects of a pyramid scheme in a town. The scheme is as follows: someone asks a person for \1$ and tells them to ask two other people for \\1 each and to tell each of them to ask for money from two others just as they are doing. In this way, the victim thinks that they are going to earn \\$$1. As there is a finite number of people in the world, not everyone can earn money this way, this is a con.
The people in town are susceptible to the con, that is, they are willing to give \$$1$ and later ask for money from two other people. However, they are willing to participate only once, that is, if they are asked for money again they will not give it or ask anyone. Once a person is asked for money, they give it immediately but can take some time before asking the other two people. The con starts with someone from outside the town asking someone in the town for money. This triggers a sequence of requests for money within the town.
For example, in the picture below we depict a town with five people. An arrow from to indicates that would ask for the money.

In this example, can lose money. We can check that with the following scenario.
- Someone from outside the town asks for money.
- asks for money.
- asks for money.
- asks for money.
- asks for money.
- asks for money.
Observe that when asks and for money, they will not give it to since they have already given money to someone else.
For each person in the town you know whom they are going to ask for money. Your task is to determine who in the town can lose money.
입력
The first line contains an integer () indicating the number of people in the town. Each person is identified by a distinct integer from to . For , the -th of the next lines contains two integers and (, and ), representing that person would ask for money to person and person .
출력
Output a single line with a string of length such that its -th character is the uppercase letter “Y” if person can lose money, and the uppercase letter “N” otherwise.