# Полуфинал Республиканской олимпиады Азербайджана 2018-2019

# Go to the finals

Welcome to the semifinal round of the Olympiad! In order to successfully pass this round, the organisers consider that the average student's grade should be no less than 3.5, and the grade for computer science should be A or B. The organisers also believe that not all students will be able to go to the finals, but they may be wrong, as this task is still not solved. Solve this problem by writing a program that will be able to identify students who have passed and have not passed to the final round.

## Input data

First line contains the number of students n (1 ≤ n ≤ 1000). Each of the next n lines contains: number `x[i]`

(0.0 < `x[i]`

≤ 5.0) - average grade of the i-th student and one symbol `y[i]`

(`y[i]`

ϵ {A, B, C, D, E, F}) - computer science grade of this student. Students are numbered from 1 to n.

## Output data

For each student in a separate line print 1 if the student goes to the final, or 0 otherwise.

## Examples

2 3.7 C 4.0 B

0 1

3 3.5 B 3.6 C 2.5 A

1 0 0