Under construction

Still being built. Things may change

NBA Draft

Time limit2sMemory limit512 MB

Summary
Classify each player into one of four draft categories by comparing five integer statistics against expected ranges and their midpoints.
Level

Easy3 of 10

Topics
Implementation, Math, Simulation, Brute force
Solved
No attempts yet

Problem

Before each season, the NBA holds a draft, a ceremony in which teams select players.

Ahead of the draft, each team's scouting department studies prospective rookies in detail. One team has asked you to write a program that processes the collected data according to the team's internal standards.

Every prospect has played at least one season in a college league, so five main integer parameters are known for each player:

  • The player's height. The expected range is 190 to 220 cm.
  • Wingspan. The expected range is 200 to 250 cm.
  • Average points per game. The expected range is 10 to 20.
  • Average rebounds per game. The expected range is 2 to 6.
  • Average assists per game. The expected range is 3 to 7.

Thus each parameter can fall below the expected range, in the lower half of the expected range, in the upper half of the expected range (the midpoint belongs to the upper half), or above the expected range.

Before the draft, the players must be sorted into the following categories:

  • A unique player (also called a unicorn), combining outstanding physical measurements and playing skill
  • A player worth a first-round pick
  • A player worth a second-round pick
  • A player not worth picking at all

If three of a player's parameters are above the expected range, and height or wingspan is necessarily among them, the player counts as a unicorn (category 0).

A player is recommended for a first-round pick (category 1) if one of the following holds:

  • Two of the player's parameters are above the expected range and one more is at least in the upper half of the expected range.
  • All of the player's parameters are at least within the expected range, and at least three of them are at least in the upper half.

A player is recommended for a second-round pick (category 2) if one of the following holds:

  • One of the player's parameters is above the expected range and one more is at least in the upper half of the expected range.
  • Three of the player's parameters are at least in the upper half of the expected range.

In all other cases, spending a draft pick on this player is not recommended (category 3).

The parameters of some of the 32 players in the current draft are given (for objectivity, the players' names are not provided). For each player, determine the category that applies to him for your team in the draft.

Input

The first line of the input contains a single integer NN, the number of players (1≤N≤321 \le N \le 32). Each player's description consists of 5 integers: height hh (150≤h≤250150 \le h \le 250), wingspan ww (150≤w≤270150 \le w \le 270), average points per game ss (5≤s≤355 \le s \le 35), average rebounds per game rr (0≤r≤100 \le r \le 10), average assists per game pp (0≤p≤100 \le p \le 10). Each number is given on a separate line.

Output

For each player, in the order they appear in the input, output one number: the draft category this player falls into according to your team's criteria.

Notes

The first player in the sample has a height above the expected range, and two more of his parameters are also above it. So this player is a unicorn. The second player falls short of a first-round pick in assists: his assists are below the expected range while all his other skills are in the upper half of that range. So the team will pick this player in the second round. The third player has three parameters above the expected range, but since neither height nor wingspan is among them, he is not a unicorn and will be picked in the first round.

Examples1

  1. Example 1

    Input
    3
    230
    190
    16
    7
    9
    205
    225
    15
    5
    2
    210
    210
    30
    9
    9
    
    Expected output
    0
    2
    1