class Email:
    def __init__(self, sender, receiver, content):
        self.sender = sender
        self.receiver = receiver
        self.content = content
        self.is_sent = False

    def send(self):
        self.is_sent = True

    def get_info(self):
        return (f"{self.sender} says to {self.receiver}: {self.content}. Sent: {self.is_sent}")

emails = []

data = input()

while data != "Stop":
    data = data.split()
    sender = data[0]
    receiver = data[1]
    content = data[2]
    email = Email(sender, receiver, content)
    emails.append(email)

    data = input()

send_emails = [int(n) for n in input().split(", ")]

for i in send_emails:
    emails[i].send()

for el in emails:
    print(el.get_info())

