# -*- coding: utf-8 -*-

__author__ = "Zasimov Alexey"
__email__ = "zasimov-a@yandex-team.ru"

import sys

if __name__ == "__main__":
    quotes = {}
    for line in map(lambda s: s.replace('\t', ' ').strip(), sys.stdin.readlines()):
        arrow, region, quoteId, unixtime = line.split(' ')
        quote = quoteId
        if quote not in quotes:
            quotes[quote] = {"new": None, "orig": None}
        if arrow == "<":
            if quotes[quote]["new"] is None:
                quotes[quote]["new"] = unixtime
        else:
            if quotes[quote]["orig"] is None:
                quotes[quote]["orig"] = unixtime

    for quoteId, unixtimes in quotes.iteritems():
        if unixtimes["new"] != unixtimes["orig"]:
            print(quoteId)

