#P1695E. Ambiguous Dominoes

    ID: 1029 Type: RemoteJudge 8000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 10 Uploaded By: Tags>constructive algorithmsdfs and similargraphs*2700

Ambiguous Dominoes

Description

Polycarp and Monocarp are both solving the same puzzle with dominoes. They are given the same set of nn dominoes, the ii-th of which contains two numbers xix_i and yiy_i. They are also both given the same mm by kk grid of values aija_{ij} such that mk=2nm\cdot k = 2n.

The puzzle asks them to place the nn dominoes on the grid in such a way that none of them overlap, and the values on each domino match the aija_{ij} values that domino covers. Dominoes can be rotated arbitrarily before being placed on the grid, so the domino (xi,yi)(x_i, y_i) is equivalent to the domino (yi,xi)(y_i, x_i).

They have both solved the puzzle, and compared their answers, but noticed that not only did their solutions not match, but none of the nn dominoes were in the same location in both solutions! Formally, if two squares were covered by the same domino in Polycarp's solution, they were covered by different dominoes in Monocarp's solution. The diagram below shows one potential aa grid, along with the two players' solutions.

Polycarp and Monocarp remember the set of dominoes they started with, but they have lost the grid aa. Help them reconstruct one possible grid aa, along with both of their solutions, or determine that no such grid exists.

The first line contains a single integer nn (1n31051 \le n \le 3\cdot 10^5).

The ii-th of the next nn lines contains two integers xix_i and yiy_i (1xi,yi2n1 \le x_i, y_i \le 2n).

If there is no solution, print a single integer 1-1.

Otherwise, print mm and kk, the height and width of the puzzle grid, on the first line of output. These should satisfy mk=2nm\cdot k = 2n.

The ii-th of the next mm lines should contain kk integers, the jj-th of which is aija_{ij}.

The next mm lines describe Polycarp's solution. Print mm lines of kk characters each. For each square, if it is covered by the upper half of a domino in Polycarp's solution, it should contain a "U". Similarly, if it is covered by the bottom, left, or right half of a domino, it should contain "D", "L", or "R", respectively.

The next mm lines should describe Monocarp's solution, in the same format as Polycarp's solution.

If there are multiple answers, print any.

Input

The first line contains a single integer nn (1n31051 \le n \le 3\cdot 10^5).

The ii-th of the next nn lines contains two integers xix_i and yiy_i (1xi,yi2n1 \le x_i, y_i \le 2n).

Output

If there is no solution, print a single integer 1-1.

Otherwise, print mm and kk, the height and width of the puzzle grid, on the first line of output. These should satisfy mk=2nm\cdot k = 2n.

The ii-th of the next mm lines should contain kk integers, the jj-th of which is aija_{ij}.

The next mm lines describe Polycarp's solution. Print mm lines of kk characters each. For each square, if it is covered by the upper half of a domino in Polycarp's solution, it should contain a "U". Similarly, if it is covered by the bottom, left, or right half of a domino, it should contain "D", "L", or "R", respectively.

The next mm lines should describe Monocarp's solution, in the same format as Polycarp's solution.

If there are multiple answers, print any.

Sample Input 1

1
1 2

Sample Output 1

-1

Sample Input 2

2
1 1
1 2

Sample Output 2

2 2

2 1
1 1

LR
LR

UU
DD

Sample Input 3

10
1 3
1 1
2 1
3 4
1 5
1 5
3 1
2 4
3 3
4 1

Sample Output 3

4 5

1 2 5 1 5
3 4 1 3 1
1 2 4 4 1
1 3 3 3 1

LRULR
LRDLR
ULRLR
DLRLR

UULRU
DDUUD
LRDDU
LRLRD

Note

Extra blank lines are added to the output for clarity, but are not required.

The third sample case corresponds to the image from the statement.