Input to this problem will consist of a (non-empty) series of up to 100 data sets, each representing a choose-your-own-adventure story. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets.
The first line contains a single integer n indicating the number of data sets.
A single data set has 2 components:
1. Page Count - A line containing a single integer X, where 1 < X < 100, indicating the number of pages in the story.
2. Page List - A sequence of X lines, each of which represents a page from the book. Each line has the following components separated from one another by single spaces:
- Line type - A single character indicating what type of line this is. It will represent either a "C" choice page, or an "E" end page. Page 1 is always a choice page.
- Text - A string of text surrounded by double quotes. Including the quotes, this component will not exceed 256 characters. The quotes are given for input purposes only and should not be considered part of the text. The text will not contain embedded double quotes.
- Choices - Two positive integers from 1 to X indicating the pages where the reader can go from this page. Only choice pages have this component.
- Ending Type - Either the text "HAPPY" or "GRISLY". There will only be one happy ending per story, and only end pages have this component.