#C11272. Promising Animals

    ID: 40570 Type: Default 1000ms 256MiB

Promising Animals

Promising Animals

You are given a list of animal data. Each animal is described by three values: an integer identifier, and two boolean values indicating whether the animal is friendly and playful.

Your task is to determine the list of animal IDs that are both friendly and playful, and then output these IDs in ascending order. In mathematical terms, given an animal \(a_i\) with booleans \(f_i\) and \(p_i\), include \(a_i\) in the output if and only if \(f_i \land p_i\) is true.

If no animal satisfies the condition, simply output an empty line.

inputFormat

The first line contains a single integer (n) representing the number of animals. Each of the following (n) lines contains three items: an integer identifier, a boolean value for friendliness (either "True" or "False"), and a boolean value for playfulness (either "True" or "False").

outputFormat

Output a single line with the sorted list of animal IDs that are both friendly and playful. The IDs should be separated by a single space. If no animal qualifies, output an empty line.## sample

4
101 True False
102 True True
103 False True
104 True True
102 104