시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB268945.797%

문제

Little Michael lives in a small country and likes to watch a TV music show which is emitted every Sunday afternoon. It presents the same songs every week and, according to votes, displays popularity list of those songs.

Michael played too long with his friend one Sunday and failed to see new popularity list. He was sad, but he soon realized that he would be able to at least partially reconstruct the popularity list next week. Apart from the positions of songs, a list contains information about change of positions of all songs with regard to their last week’s positions. More precisely, each song is given a mark indicating whether that song stayed at same position, gained or lost popularity since last week.

Write a program that will using given popularity list help Michael to determine one possible last week’s popularity list.

입력

The first line of input file contains an integer N, 1 ≤ N ≤ 100, number of songs on popularity list.

Next N blocks describe a popularity list. A block consists of two lines. First line of ith block contains name of ith song. A name of a song consists of at most 100 uppercase letters of English alphabet. Second line of a block contains one of three words: UP (a song went up on a list), DOWN (a song went down on a list) or SAME (position stayed the same), describing a change on a list with respect to last week’s list.

출력

The output file contains one possible popularity list from last week in N lines.

Each line should contain name of a song so that ith line contains name of ith song on a list.

Note: A solution needs not to be unique, but there always will be at least one solution for each test data.

예제 입력 1

4
LOVE
UP
WINE
UP
WATER
DOWN
HATE
DOWN

예제 출력 1

WATER
HATE
LOVE
WINE

예제 입력 2

4
HOTDOG
UP
HAMBURGER
DOWN
ICECREAM
SAME
FRENCHFRIES
DOWN

예제 출력 2

HAMBURGER
FRENCHFRIES
ICECREAM
HOTDOG

예제 입력 3

5
HIGHHOPES
UP
LOWFEELINGS
UP
UPANDDOWN
DOWN
IAMSTILLSTANDING
DOWN
FOOLINGAROUND
DOWN

예제 출력 3

UPANDDOWN
IAMSTILLSTANDING
FOOLINGAROUND
HGHHOPES
LOWFEELINGS