All Tracks Algorithms Greedy Algorithms Basics of Greedy Algorithms Problem

Little Jhool and his punishment

Basic Programming, Greedy Algorithms


Little Jhool was was the most intelligent kid of his school. But he did NOT like his class teacher, his school, and the way he was taught things in school. Well, he was a rebel, to say the least. Like most of us, he hated being punished by his teacher - specially, when the punishment was to sit beside someone of the opposite gender. (Oh, he was a kid, come on!)

There are n number of students in the class, b being the number of boys, and g being the number of girls. Little Jhool decided to challenge his class teacher when she started punishing the entire class using the aforesaid mentioned punishment - making them sit in a straight line outside the class, beside someone of the opposite gender.

The challenge is as follows: Little Jhool selects a student from the class and make him or her sit outside the class. Then, his teacher picks another student from the remaining students, and makes him or her sit next in the line. Little Jhool and teacher then take alternate turns, until all the students of the class are seated.

If the number of pairs of neighboring students of the same gender is GREATER than the number of pairs of neighboring students of the opposite gender, output "Little Jhool wins!" , otherwise, "The teacher wins!"

Input format:
The first line contains, tc, the number of test cases. Following that, the next line contains n, the total number of students in the class. Then, in the next line, there are two integers, b and g representing the number of boys and girls in the class, respectively.

Output format:
You have to print "Little Jhool wins!" or "The teacher wins!" according to the condition.

1 <= t <= 50
1 <= n, b, g <= 100

PS: -> n = b + g
-> There will always be at least one boy and one girl in the class.

3 1
2 1
Little Jhool wins!
The teacher wins!
Time Limit: 1.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


Initializing Code Editor...
Your Rating:


This Problem was Asked in


Challenge Name

June-O! (A Tribute to humblefool)

View All Notifications