The first line contains the number of statements n (1≤n≤105).
Each of the next n lines describes the size relation between two dwarves. A line has the form s1 < s2 or s1 > s2, with one space between each name and the comparison sign. s1 < s2 means that dwarf s1 is smaller than dwarf s2, and s1 > s2 means that s1 is taller than s2. s1 and s2 are two different names.
A dwarf name consists of at most 20 letters from A to Z and a to z, and it contains no spaces. Upper case and lower case letters count as different letters. At most 104 different dwarves appear.