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

#GD0000150. Thu thập bưu kiện (Collecting Packages)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Thu thập bưu kiện (Collecting Packages)

Collecting Packages

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A robot starts at (0,0)(0,0) on an integer-coordinate grid. There are nn distinct packages at coordinates (xi,yi)(x_i,y_i), none at the origin. The robot may move one cell right (R) or up (U) per step.

Find a walk that visits every package using the minimum possible number of moves. If several minimum-length walks exist, choose the lexicographically smallest command string (R comes before U).

Input

The first line contains nn. The next nn lines each contain coordinates xi,yix_i,y_i of a package.

Output

Print NO if no walk can collect every package. Otherwise print YES followed by the lexicographically smallest among all shortest command strings made of R and U.

Subtasks

  • Subtask 1 (20 points): 1≤n≤151\le n\le15; 0≤xi,yi≤300\le x_i,y_i\le30; points are distinct and different from (0,0)(0,0).
  • Subtask 2 (30 points): 1≤n≤1001\le n\le100; 0≤xi,yi≤2000\le x_i,y_i\le200; points are distinct and different from (0,0)(0,0).
  • Subtask 3 (50 points): 1≤n≤10001\le n\le1000; 0≤xi,yi≤10000\le x_i,y_i\le1000; points are distinct and different from (0,0)(0,0).

Examples

Input

1
4 3

Output

YES
RRRRUUU

Explanation

A package at (4,3)(4,3) requires exactly four R moves and three U moves. The lexicographically smallest shortest path is RRRRUUU, of total length seven.