n = int(input())
Y = set() # set of YESs
N = set() # set of NOs
P = {int(i) for i in range(n)}# secrete number range
while True:
    help_requested = input()
    if help_requested != "HELP":
        BG = {int(i) for i in help_requested.split(' ')}
        AA = input()
        if AA == "YES":
            P.intersection_update(BG)
        else:
            N.update(BG)
            P.difference_update(N)
    else:
        result = list(P)
        result.sort()
        print(' '.join(str(i) for i in result))
        break

d39872c8b4e55cd6d67f0242b3e038e2a3eddaf8
<mask token>

<mask token>
while True:
    help_requested = input()
    if help_requested != 'HELP':
        BG = {int(i) for i in help_requested.split(' ')}
        AA = input()
        if AA == 'YES':
            P.intersection_update(BG)
        else:
            N.update(BG)
            P.difference_update(N)
    else:
        result = list(P)
        result.sort()
        print(' '.join(str(i) for i in result))
        break

n = int(input())
Y = set()
N = set()
P = {int(i) for i in range(n)}
while True:
    help_requested = input()
    if help_requested != 'HELP':
        BG = {int(i) for i in help_requested.split(' ')}
        AA = input()
        if AA == 'YES':
            P.intersection_update(BG)
        else:
            N.update(BG)
            P.difference_update(N)
    else:
        result = list(P)
        result.sort()
        print(' '.join(str(i) for i in result))
        break

n = int(input())
Y = set() # set of YESs
N = set() # set of NOs
P = {int(i) for i in range(n)}# secrete number range
while True:
    help_requested = input()
    if help_requested != "HELP":
        BG = {int(i) for i in help_requested.split(' ')}
        AA = input()
        if AA == "YES":
            P.intersection_update(BG)
        else:
            N.update(BG)
            P.difference_update(N)
    else:
        result = list(P)
        result.sort()
        print(' '.join(str(i) for i in result))
        break
