409784: GYM103743 A PENTA KILL!

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. PENTA KILL!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

OLO's global tournament, ISM, is in full swing and Shizuku is a big fan of GNR which is taking part in the tournament. OLO is a game where two teams of five players play against each other. PENTA KILL is considered an unbelievable achievement in the game, which means one player kills five pairwise distinct opponents in a row. We assume that a player will be resurrected immediately after his death, and the death will not affect the verdict of his PENTA KILL.

Normally, PENTA KILL will be displayed in the game. However, sometimes due to unintended disparity in latency between competing teams, it is not displayed properly in the game. After the game, Shizuku gets a chronological list of kills during the game. She wants to know whether a player has achieved PENTA KILL in this game.

Input

The first line contains an integer $$$n$$$ ($$$1\le n \le 1000$$$), indicating the number of kills in the game.

Each of the following $$$n$$$ lines contains two strings $$$a$$$ and $$$b$$$ consisting of English letters and digital numbers, indicating that the player named $$$a$$$ kills the player named $$$b$$$. The length of each string won't exceed $$$100$$$. It is guaranteed that there are no kills between teammates and there are exactly five players per team.

Output

Output PENTA KILL! if a player has achieved PENTA KILL, or SAD:( otherwise.

ExamplesInput
10
Bin Guigo
Grevthar Bin
GALA Grevthar
GALA TitaN
GALA Guigo
GALA Aegis
GALA Jojo
GALA Grevthar
Xiaohu Grevthar
GALA Aegis
Output
PENTA KILL!
Input
7
GALA Jojo
GALA Jojo
Aegis GALA
GALA Grevthar
GALA Aegis
GALA Guigo
GALA TitaN
Output
PENTA KILL!
Input
7
GALA Jojo
Aegis Ming
GALA Grevthar
GALA Grevthar
GALA Aegis
GALA Guigo
GALA TitaN
Output
SAD:(
Note

In the second sample, GALA kills Jojo, Grevthar, Aegis, Guigo, and TitaN in a row so he gets PENTA KILL.

In the third sample, GALA kills Grevthar twice after he kills Jojo so he doesn't kill five distinct opponents in a row.

加入题单

算法标签: