#abc371b. B - Taro
B - Taro
Score : points
问题陈述
在AtCoder王国中,长子总是被命名为太郎。没有人被命名为太郎。长子是每个家庭中最早出生的男性孩子。
AtCoder王国有个家庭,并且有个婴儿出生。在个婴儿出生之前,个家庭都没有孩子。
关于婴儿的信息是按照他们出生的顺序给出的。
第个出生的婴儿出生在家庭,如果是M
,那么这个婴儿是男性,如果是F
,那么是女性。
确定个婴儿中每一个是否被命名为太郎。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
In the Kingdom of AtCoder, the eldest son is always given the name Taro. No one else is given the name Taro. The eldest son is the earliest born male child in each family.
There are families in the Kingdom, and babies were born. Before the babies were born, none of the families had had any babies.
Information about the babies is given in chronological order of their birth.
The -th baby born was born in family , and the baby is male if is M
, and female if it is F
.
Determine for each of the babies whether the name given is Taro.
Constraints
- is
M
orF
. - All numbers in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain Yes
if the name given to the -th baby is Taro, and No
otherwise.
Sample Input 1
2 4
1 M
1 M
2 F
2 M
Sample Output 1
Yes
No
No
Yes
The first baby is the earliest born boy in family , so he is named Taro.
The second baby is not the earliest born boy in family , so he is not named Taro.
The third baby is a girl, so she is not named Taro.
The fourth baby is the earliest born boy in family , so he is named Taro. Note that the third baby is also born in family , but it is the earliest born boy who is named Taro.
Sample Input 2
4 7
2 M
3 M
1 F
4 F
4 F
1 F
2 M
Sample Output 2
Yes
Yes
No
No
No
No
No