ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

[Online] ICPC Ural Regional Contest Qualifier 2026

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Tales of the Enthusiasts

Time limit: 1.0 second
Memory limit: 256 MB
A calm day. The sea breeze tickles the face and blows through the hair. Serenity and peace — what else is needed for happiness? Unfortunately, there is not much to do at sea on such a wonderful day. By chance, Velvet, Eizen, and Laphicet were left alone and decided to entertain themselves somehow.
Fortunately, shortly before that, the friends managed to obtain N closed chests. Chests come in two types: ordinary chests and katz chests. To open an ordinary chest, one must spend xi coins, but inside there will definitely be a scroll that restores yi units of magical energy. To open a katz chest, one must spend xi units of magical energy, but inside there will definitely be yi coins. The values xi, yi may differ for different pairs of chests. Initially, the team has cg coins and cs units of magical energy.
Laphicet is interested in finding out what lies in ordinary chests besides magical scrolls, Eizen, on the contrary, is interested in the contents of katz chests, while Velvet simply likes opening chests. To satisfy everyone’s interests, Velvet decided to open at least 1 ordinary chest and at least 1 katz chest. Your task is to find a suitable sequence of chest openings.

Input

The first line contains 3 integers N, cg, and cs (1 ≤ N ≤ 500, 1 ≤ cg, cs, ≤ 104).
Each of the next N lines contains 3 integers ti, xi, and yi (t ∈ {1, 2}; 1 ≤ xi, yi ≤ 104) — the description of the i-th chest. If ti = 1, then this chest is ordinary. If ti = 2, then this is a katz chest.

Output

If it is impossible to open at least one chest of each type, output “Still Bored” without quotes in the only line.
Otherwise, output “Happy Happy Happy” without quotes in the first line, an integer K in the second line — the length of a suitable sequence, and K distinct integers in the third line. If there are several suitable sequences, any of them may be output. A sequence is considered correct if it contains chests of both types and, during the process of opening the chests in the order of the sequence, neither the number of coins nor the amount of magical energy becomes negative.

Samples

inputoutput
3 3 3
1 1 1
1 2 2
2 6 1
Happy Happy Happy
3
2 1 3
2 10 10
2 11 1
1 11 1
Still Bored
4 3 3
1 1 1
2 10 10
1 10 10
2 1 1
Happy Happy Happy
2
1 4
Problem Author: Yackov Malin
Problem Source: The 2026 ICPC Ural Qualification