#K54582. Workshop Participant Registration

    ID: 29785 Type: Default 1000ms 256MiB

Workshop Participant Registration

Workshop Participant Registration

In this problem, you are given details of multiple workshops along with participant signup attempts. Each workshop has a title, a maximum number of participants available, and a scheduled start time. When a participant attempts to register for a workshop, they are "Registered" if the current number of registered participants is less than the maximum; otherwise, they are "Rejected".

The input consists of several test cases. For each test case, the workshops are listed first, followed by the registration attempts. The registration process for each test case is handled independently. Your task is to process all test cases and print the registration result for each participant in the order they appear.

Note: All formulas or mathematical expressions, if any, must be written in \(\LaTeX\) format.

inputFormat

The input is read from stdin and has the following format:

T
W
Workshop_Title1,Max_Participants1,Start_Time1
Workshop_Title2,Max_Participants2,Start_Time2
... (W lines)
P
Participant_Name1,Workshop_Title
Participant_Name2,Workshop_Title
... (P lines)
... (Repeat the above for T test cases)

Here, T is the number of test cases. For each test case, W represents the number of workshops, and the following W lines each contain a workshop's title, the maximum allowed participants, and its start time (in minutes), separated by commas. After that, an integer P is given, representing the number of participants. Then follow P lines where each line contains a participant's name and the workshop title they want to sign up for, separated by a comma.

outputFormat

For each participant in the order they sign up, output a single line containing either Registered if their registration is successful, or Rejected if the workshop has already reached its maximum capacity.

## sample
3
3
Python Beginners,10,600
Data Science,5,900
Web Development,7,720
5
Alice,Python Beginners
Bob,Data Science
Charlie,Python Beginners
Diana,Web Development
Eve,Data Science
2
Python Beginners,2,600
Data Science,1,900
4
Alice,Python Beginners
Bob,Data Science
Charlie,Python Beginners
Diana,Data Science
2
Python Beginners,5,600
Data Science,3,900
0
Registered

Registered Registered Registered Registered Registered Registered Registered Rejected

</p>