PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FW0000031. Đến lễ hội bằng các điểm tiếp tế (Kastenlauf)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đến lễ hội bằng các điểm tiếp tế (Kastenlauf)

Kastenlauf

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

Starting at home with supplies for 1000 meters of Manhattan travel, replenishing at shops, determine whether the festival is reachable.

Input

Integer nn stores, followed by n+2n+2 coordinate pairs: home, the stores, and the festival.

Output

Print happy if the festival is reachable, otherwise sad.

Subtasks

  • Subtask 1 (40 points): n≤8n\le8; 0≤n≤1000\le n\le100, −32768≤x,y≤32767-32768\le x,y\le32767; Manhattan distance, each hop at most 10001000.
  • Subtask 2 (60 points): 0≤n≤1000\le n\le100, −32768≤x,y≤32767-32768\le x,y\le32767; Manhattan distance, each hop at most 10001000.

Examples

Input

2
0 0
1000 0
1000 1000
2000 1000

Output

happy

Explanation

There are three successive Manhattan hops of 10001000 meters: home to first store, first to second store, then second store to festival. Refilling at each store makes arrival possible.