## SAC '22 Code Challenge 2 P1 - Calendar Management

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Since Zain is a busy student, he keeps a calendar with all his important upcoming assessments. However, Zain keeps forgetting to check his calendar and occasionally checks it!

Given this information, Zain wants you to tell him the assessments he has today or has had since his last check (if it is his first check, assume it started before the first assessment in his calendar).

Currently, Zain has upcoming assessments throughout the month, each having a day they are completed, , and name.

Zain will check his calendar a total of times and tell you the current day, .

Can you help him?

#### Input Specification

The first line will contain and , the number of assessments in the month and the number of checks.

The next lines will contain the day, , and name of the assessment.

The name of an assessment will be at most characters long and only contain lowercase letters, uppercase letters, and _.

The next lines will contain a day Zain checks the calendar, for all .

Note: The assessments for a given check should be output in the order given in the input.

#### Output Specification

For each check, output all the assessments between the last check and the current day on different lines (including the current day).

#### Sample Input

3 5
3 Physics
6 English
5 Rock_throwing
1
3
6
7
8

#### Sample Output

Physics
English
Rock_throwing

#### Explanation for Sample Output

The first check has no assessments, the second check has Physics, the third check has English and Rock_throwing (note the order they were output), and every other check has no assessments.