

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
AtCoder 王国では、長男に必ず「太郎」という名前を付けます。長男以外には「太郎」という名前は付けません。 長男とは、各家で生まれた男の子のうち最も早く生まれた者を指します。
AtCoder 王国には 戸の家があり、 人の赤子が生まれました。また、 人の赤子が生まれる前には、 戸のどの家も赤子が生まれたことはありませんでした。
赤子の情報が生まれの時系列順に与えられます。
番目に生まれた赤子は、 番目の家で生まれ、 が M
のとき男の子、F
のとき女の子です。
人の赤子それぞれについて、付けられた名前が「太郎」か判定してください。
制約
- は
M
またはF
- 入力される数値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
行出力せよ。
行目には、 番目に生まれた赤子の名前が「太郎」ならば Yes
を、そうでない場合 No
を出力せよ。
入力例 1Copy
2 4 1 M 1 M 2 F 2 M
出力例 1Copy
Yes No No Yes
番目に生まれた赤子は、家 で生まれた男の子のうち最も早く生まれた者なので「太郎」です。
一方、 番目に生まれた赤子は、家 で生まれた男の子のうち最も早く生まれた者ではないので「太郎」ではありません。
番目に生まれた赤子は、女の子なので「太郎」ではありません。
番目に生まれた赤子は、家 で生まれた男の子のうち最も早く生まれた者なので「太郎」です。 番目に生まれた赤子も家 で生まれていますが、男の子のうち最も早く生まれた者を「太郎」と名付けることに注意してください。
入力例 2Copy
4 7 2 M 3 M 1 F 4 F 4 F 1 F 2 M
出力例 2Copy
Yes Yes No No No No No
Score : points
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 1Copy
2 4 1 M 1 M 2 F 2 M
Sample Output 1Copy
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 2Copy
4 7 2 M 3 M 1 F 4 F 4 F 1 F 2 M
Sample Output 2Copy
Yes Yes No No No No No