#K59237. Warrior Qualification

    ID: 30820 Type: Default 1000ms 256MiB

Warrior Qualification

Warrior Qualification

You are given the task of determining whether a warrior qualifies for a special rank based on his scores. For each warrior, you are given six integers — three minimum required scores and three actual scores, and an overall required total score. Formally, for each test case, you are provided with seven integers:

  • \(S_{min}\): minimum required sword skill
  • \(P_{min}\): minimum required power
  • \(I_{min}\): minimum required intelligence
  • \(R_{min}\): minimum required sum score
  • \(S\): warrior's sword skill
  • \(P\): warrior's power
  • \(I\): warrior's intelligence

The warrior qualifies if and only if:

\(S \ge S_{min},\; P \ge P_{min},\; I \ge I_{min}\) and \(S + P + I \ge R_{min}\).

Your task is to read the input, process each test case, and print "QUALIFIED" if the warrior meets the criteria or "DISQUALIFIED" otherwise.

inputFormat

The first line of input contains an integer \(T\) denoting the number of test cases.

Each of the following \(T\) lines contains 7 integers separated by spaces:

  • \(S_{min}\), \(P_{min}\), \(I_{min}\), \(R_{min}\), \(S\), \(P\), \(I\)

outputFormat

For each test case, print a single line containing the result: either "QUALIFIED" or "DISQUALIFIED".

## sample
1
2 2 2 6 2 2 2
QUALIFIED