#!/usr/bin/env python3
import functools

lt = [[None for j in range(26)] for i in range(26)]
impossible = 'IMPOSSIBLE'

nc = int(input())
for i in range(nc):
  a, sg, b = input().split()
  a = ord(a) - ord('a')
  b = ord(b) - ord('a')
  assert(sg in ('<','>'))
  sg = (sg == '<')
  if lt[a][b] is not None and lt[a][b] != sg:
    print(impossible)
    exit(0)
  lt[a][b] = sg
  lt[b][a] = not sg

if True in [lt[i][i] for i in range(26)]:
  print(impossible)
  exit(0)

def compare(a, b):
  a = ord(a) - ord('a')
  b = ord(b) - ord('a')
  if lt[a][b]: return -1
  if lt[b][a]: return +1
  return 0

s = ''.join(sorted(input(), key=functools.cmp_to_key(compare)))
print(s)
