Complete the Syllabus
Tag(s):

Problem
Editorial
Analytics

Ash is preparing for his End semester exams and there are total K topics which he has to cover so that he can perform well in it. He has decided that he will study the topics sequentially. So, he is going to start from "MONDAY". Ash has got a very tight schedule and for each day of the week he already knows how many topics will he be able to study on a particular day.

It is guaranteed that Ash will not skip any day and will follow the routine sincerely, Determine on which day of the week will he be able to complete all the topics. (1st day of week is assumed to be MONDAY).

INPUT:-

First line of each test file contains the number of test cases T, Each test case will contain a positive integer K followed by array A in the next line which has 7 integers denoting the number of topics which Ash will be able to cover on a particular day of week A[0] will be for MONDAY, A[1] will be for TUESDAY ,..., A[6] will be SUNDAY.

OUTPUT:-

For each test case print the day of week in capital letters on which he will complete his syllabus.

CONSTRAINTS:-

$1<= T <= 10^3$

$1<=K<=10^9$

$0 <= A[i] <= 10^9$

SAMPLE INPUT
3
7
1 1 1 1 1 1 1
2
1 1 0 0 0 0 0
10
0 0 0 0 0 0 1
SAMPLE OUTPUT
SUNDAY
TUESDAY
SUNDAY
Explanation

For the first test case its quiet evident that Ash will complete the syllabus on SUNDAY.

For the second on every MONDAY and TUESDAY he is going to complete one topic but there are only 2 of them , so he will complete it on TUESDAY.

For the last test case Ash is going to cover 1 topic on every SUNDAY so he will complete all the topics on SUNDAY.

Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, C++17, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, Java 14, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, Python 3.8, R(RScript), Racket, Ruby, Rust, Scala, Swift-4.1, Swift, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

CodeRing - IV

OTHER PROBLEMS OF THIS CHALLENGE
• Data Structures > Disjoint Data Structures
• Math > Basic Math
• Data Structures > Advanced Data Structures
• Math > Game Theory