Go Back
Nap, hack, repeat. (200)

Venky, Sarthak and Sanoop have decided to participate in ByteCamp2019. They have to finish their hack within the time limit of 24 hours. As working continuously may tire them, they decided that at any given time one of them would take nap while other two will work.
So they have come up with list of timestamps and the name of person who would start napping. Venky, Sarthak and Sanoop can finish the entire work individually by X1, X2 and X3 hours respectively. Help them decide if they can complete their hack within 24 hours from start. Assume hackathon to start at 00:00 and that same person may nap again.


The first line of input contain an integer T denoting the number of test cases.
First line of each test case contains N denoting number of timestamps.
It is followed by a line containing 3 space separated integers X1,X2 and X3.
Next N lines of each test case contain time stamp(properly ordered) and name separated by space.
Time stamp is in HH:MM (24hours) format.


For each test case, output a single line with:
“Successful Hack”(without quotes) if the list is feasible.
“Oopsie Dopsie”(without quotes) for all other conditions.


0 < T < 101

0 < N < 21

0 < X1,X2,X3 < 1000

Copy Input

310 409 560
00:00 Sanoop
04:25 Venky
13:36 Venky
19:08 Sarthak
24 28 20
00:00 Sarthak
02:00 Venky
15:40 Sarthak
23:08 Sanoop

Oopsie Dopsie
Successful Hack


Test Case 1:
They are not able to complete 100% of the work.

Test Case 2:
They can complete their work within 24hrs.

Single Round Match #07
3 hour contest

Register for Bytecamp 2019 here: https://bytecamp19.hackerearth.com/

Problem Tags

Supported by our Coding Partner