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

#GD0000022. Lịch công việc đúng hạn (Megalomania)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Lịch công việc đúng hạn (Megalomania)

Megalomania

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn jobs. Job ii needs aia_i units of processing time and must finish no later than deadline bib_i. Only one job can be processed at a time and jobs cannot be interrupted. Determine whether all jobs can meet their deadlines.

Input

The first line contains nn. Each of the next nn lines contains ai,bia_i,b_i.

Output

Print Yes if a feasible schedule exists, otherwise print No.

Constraints

  • 1≤n≤2⋅1051\le n\le 2\cdot10^5.
  • 1≤ai,bi≤1091\le a_i,b_i\le 10^9 for 1≤i≤n1\le i\le n.

Subtasks

  • Subtask 1 (20 points): n≤8n\le 8.
  • Subtask 2 (30 points): n≤30n\le 30.
  • Subtask 3 (50 points): Full constraints.

Examples

Input

5
2 4
1 9
1 8
4 9
3 12

Output

Yes

Explanation

The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.