AtCoder Beginner Contest 111 - Robot Arms

Snuke is introducing a robot arm with the following properties to his factory:
 - The robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Section i connects Joint i-1 and Joint i. The length of Section i is d_i.
 - For each section, its mode can be specified individually. There are four modes: L, R, D and U. The mode of a section decides the direction of that section. If we consider the factory as a coordinate plane, the position of Joint i will be determined as follows (we denote its coordinates as (x_i, y_i)):
 - (x_0, y_0) = (0, 0).
 - If the mode of Section i is L, (x_{i}, y_{i}) = (x_{i-1} - d_{i}, y_{i-1}).
 - If the mode of Section i is R, (x_{i}, y_{i}) = (x_{i-1} + d_{i}, y_{i-1}).
 - If the mode of Section i is D, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} - d_{i}).
 - If the mode of Section i is U, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} + d_{i}).
Snuke would like to introduce a robot arm so that the position of Joint m can be matched with all of the N points (X_1, Y_1), (X_2, Y_2), ..., (X_N, Y_N) by properly specifying the modes of the sections.
Is this possible?
If so, find such a robot arm and how to bring Joint m to each point (X_j, Y_j).

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 1000
 - -10^9 \leq X_i \leq 10^9
 - -10^9 \leq Y_i \leq 10^9

-----Partial Score-----
 - In the test cases worth 300 points, -10 \leq X_i \leq 10 and -10 \leq Y_i \leq 10 hold.

-----Input-----
Input is given from Standard Input in the following format:
N
X_1 Y_1
X_2 Y_2
:
X_N Y_N

-----Output-----
If the condition can be satisfied, follow the following format. If the condition cannot be satisfied, print -1.
m
d_1 d_2 ... d_m
w_1
w_2
:
w_N

m and d_i are the configurations of the robot arm. Refer to the problem statement for what each of them means.
Here, 1 \leq m \leq 40 and 1 \leq d_i \leq 10^{12} must hold. Also, m and d_i must all be integers.
w_j is a string of length m that represents the way to bring Joint m of the robot arm to point (X_j, Y_j).
The i-th character of w_j should be one of the letters L, R, D and U, representing the mode of Section i.

-----Sample Input-----
3
-1 0
0 3
2 -1

-----Sample Output-----
2
1 2
RL
UU
DR

In the given way to bring Joint m of the robot arm to each (X_j, Y_j), the positions of the joints will be as follows:
 - To (X_1, Y_1) = (-1, 0): First, the position of Joint 0 is (x_0, y_0) = (0, 0). As the mode of Section 1 is R, the position of Joint 1 is (x_1, y_1) = (1, 0). Then, as the mode of Section 2 is L, the position of Joint 2 is (x_2, y_2) = (-1, 0).
 - To (X_2, Y_2) = (0, 3): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, 1), (x_2, y_2) = (0, 3).
 - To (X_3, Y_3) = (2, -1): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, -1), (x_2, y_2) = (2, -1).

Source: atcoder | Difficulty: MEDIUM_HARD


Solutions:
import numpy as np
N = int(input())
XY = np.array([[int(x) for x in input().split()] for _ in range(N)], dtype=np.int64)
X = XY[:, 0]
Y = XY[:, 1]
command = np.array([''] * N, dtype=object)

def solve(k, X, Y, arms, command):
	if k == -1:
		return solve_final(X, Y, arms, command)
	bl_X = np.abs(X) > np.abs(Y)
	bl_Y = ~bl_X
	negative_X = X < 0
	negative_Y = Y < 0
	L = bl_X & negative_X
	R = bl_X & ~negative_X
	D = bl_Y & negative_Y
	U = bl_Y & ~negative_Y
	command[L] += 'L'
	command[R] += 'R'
	command[D] += 'D'
	command[U] += 'U'
	p = 1 << k
	arms.append(p)
	X[L] += p
	X[R] -= p
	Y[D] += p
	Y[U] -= p
	return solve(k - 1, X, Y, arms, command)

def solve_final(X, Y, arms, command):
	s = np.abs(X) + np.abs(Y)
	bl0 = (s == 0).all()
	bl1 = (s == 1).all()
	if bl0:
		return (arms, command)
	elif not bl1:
		return (None, None)
	arms.append(1)
	L = X == -1
	R = X == 1
	D = Y == -1
	U = Y == 1
	command[L] += 'L'
	command[R] += 'R'
	command[D] += 'D'
	command[U] += 'U'
	return (arms, command)
(arms, command) = solve(35, X, Y, [], command)
if arms is None:
	print(-1)
else:
	print(len(arms))
	print(' '.join([str(x) for x in arms]))
	print('\n'.join(command))


N = int(input())
Points = [list(map(int, input().split())) for i in range(N)]
odd_or_even = set([(x + y) % 2 for (x, y) in Points])
if len(odd_or_even) == 2:
	print(-1)
	exit()
D = [2 ** i for i in range(39)]
D = D[::-1]
if 0 in odd_or_even:
	D.append(1)
print(len(D))
print(' '.join(map(str, D)))
operation = {'R': (-1, 0), 'L': (1, 0), 'U': (0, -1), 'D': (0, 1)}
for (x, y) in Points:
	(nx, ny) = (x, y)
	ans = ''
	for d in D:
		best_score = float('inf')
		best_command = None
		(next_x, next_y) = (None, None)
		for (command, move) in operation.items():
			(mx, my) = move
			(tx, ty) = (nx + d * mx, ny + d * my)
			score = abs(tx) + abs(ty)
			if score < best_score:
				best_score = score
				best_command = command
				(next_x, next_y) = (tx, ty)
		ans += best_command
		(nx, ny) = (next_x, next_y)
	print(ans)


import sys
input = sys.stdin.readline
N = int(input())
ARM = [list(map(int, input().split())) for i in range(N)]
OE = [(ARM[i][0] + ARM[i][1]) % 2 for i in range(N)]
if len(set(OE)) == 2:
	print(-1)
	sys.exit()
if OE[0] == 1:
	m = 38
	print(m)
	print(*[1 << i for i in range(m)])

	def URLD(x, y, m):
		if abs(x) >= abs(y):
			if x >= 0:
				return ('R', (x - (1 << m), y))
			else:
				return ('L', (x + (1 << m), y))
		elif y >= 0:
			return ('U', (x, y - (1 << m)))
		else:
			return ('D', (x, y + (1 << m)))
	for (x, y) in ARM:
		ANS = []
		for i in range(m - 1, -1, -1):
			(a, (x, y)) = URLD(x, y, i)
			ANS.append(a)
		print(''.join(ANS[::-1]))
else:
	m = 39
	print(m)
	print(1, *[1 << i for i in range(m - 1)])

	def URLD(x, y, m):
		if abs(x) >= abs(y):
			if x >= 0:
				return ('R', (x - (1 << m), y))
			else:
				return ('L', (x + (1 << m), y))
		elif y >= 0:
			return ('U', (x, y - (1 << m)))
		else:
			return ('D', (x, y + (1 << m)))
	for (x, y) in ARM:
		ANS = []
		for i in range(m - 2, -1, -1):
			(a, (x, y)) = URLD(x, y, i)
			ANS.append(a)
		if x == 1:
			ANS.append('R')
		elif x == -1:
			ANS.append('L')
		elif y == 1:
			ANS.append('U')
		else:
			ANS.append('D')
		print(''.join(ANS[::-1]))


N = int(input())
point = [tuple(map(int, input().split())) for i in range(N)]
point_farthest = max(point, key=lambda p: abs(p[0]) + abs(p[1]))
mod = sum(point_farthest) % 2
D = [1, 1] if mod == 0 else [1]
while sum(D) < abs(point_farthest[0]) + abs(point_farthest[1]):
	D.append(D[-1] * 2)
D.reverse()
W = []
for (x, y) in point:
	if (x + y) % 2 != mod:
		print(-1)
		return
	w = ''
	for d in D:
		if abs(x) >= abs(y):
			if x > 0:
				w += 'R'
				x -= d
			else:
				w += 'L'
				x += d
		elif y > 0:
			w += 'U'
			y -= d
		else:
			w += 'D'
			y += d
	W.append(w)
print(len(D))
print(*D)
print(*W, sep='\n')


n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
	if (abs(x[i]) + abs(y[i])) % 2 != (abs(x[0]) + abs(y[0])) % 2:
		print(-1)
		return
D = []
for i in reversed(range(33)):
	D.append(1 << i)
D += [1, 1]
if (abs(x[0]) + abs(y[0])) % 2 == 0:
	D.append(1)
print(len(D))
print(*D)
for i in range(n):
	(X, Y) = (x[i], y[i])
	s = ''
	for d in D:
		if abs(X) > abs(Y):
			if X > 0:
				X -= d
				s += 'R'
			else:
				X += d
				s += 'L'
		elif Y > 0:
			Y -= d
			s += 'U'
		else:
			Y += d
			s += 'D'
	print(s)


from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10 ** 5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right

def LI():
	return list(map(int, stdin.readline().split()))

def LF():
	return list(map(float, stdin.readline().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, stdin.readline().split()))

def II():
	return int(stdin.readline())

def IF():
	return float(stdin.readline())

def LS():
	return list(map(list, stdin.readline().split()))

def S():
	return list(stdin.readline().rstrip())

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def A():
	n = S()
	for i in n:
		if i == '1':
			print(9, end='')
		else:
			print(1, end='')
	print()
	return

def B():
	n = II()
	for i in range(111, 1000, 111):
		if n <= i:
			print(i)
			return
	return

def C():
	return

def D():
	n = II()
	xy = LIR(n)
	xy_ = [a + b for (a, b) in xy]
	RULD = ['R', 'U', 'L', 'D']
	R = 0
	if len(set(map(lambda x: x & 1, xy_))) == 2:
		print(-1)
		return
	ans = [1 << i for i in range(33)]
	f = xy[0][0] + xy[0][1] & 1 ^ 1
	if f:
		ans = [1] + ans
	xy = [[abs(x - f), abs(y), (x - f < 0) << 0 | (y < 0) << 1] for (x, y) in xy]
	lis = []
	for (x, y, p) in xy:
		b = x & 1 ^ 1
		tmp = [b]
		for i in range(1, 33):
			if b == R:
				if x >> i & 1:
					if y >> i & 1:
						k = i
						while x >> k & 1:
							x ^= 1 << k
							k += 1
						x ^= 1 << k
						tmp[-1] ^= 2
						b ^= 1
						tmp.append(b)
					else:
						tmp.append(b)
				elif y >> i & 1:
					b ^= 1
					tmp.append(b)
				else:
					tmp[-1] ^= 2
					tmp.append(b)
			elif y >> i & 1:
				if x >> i & 1:
					k = i
					while y >> k & 1:
						y ^= 1 << k
						k += 1
					y ^= 1 << k
					tmp[-1] ^= 2
					b ^= 1
					tmp.append(b)
				else:
					tmp.append(b)
			elif x >> i & 1:
				b ^= 1
				tmp.append(b)
			else:
				tmp[-1] ^= 2
				tmp.append(b)
		for i in range(33):
			if p & 1:
				if tmp[i] & 1 ^ 1:
					tmp[i] ^= 2
			if p & 2:
				if tmp[i] & 1:
					tmp[i] ^= 2
		lis.append(map(lambda x: RULD[x], tmp))
	print(33 + f)
	print(*ans)
	for a in lis:
		print('R' * f + ''.join(a))
	return
D()


n = int(input())
grid = [list(map(int, input().split())) for i in range(n)]
for i in range(n - 1):
	if (grid[i][0] + grid[i][1]) % 2 != (grid[i + 1][0] + grid[i + 1][1]) % 2:
		print(-1)
		exit()
m = 31
D = [2 ** i for i in range(m)]
if (grid[0][0] + grid[0][1]) % 2 == 0:
	D.insert(0, 1)
	m += 1
w = [[] for i in range(n)]
for (i, g) in enumerate(grid):
	(x, y) = g
	for d in D[::-1]:
		if abs(x) >= abs(y):
			if x > 0:
				x -= d
				w[i].append('R')
			else:
				x += d
				w[i].append('L')
		elif y > 0:
			y -= d
			w[i].append('U')
		else:
			y += d
			w[i].append('D')
print(m)
print(*D)
for ans in w:
	print(*ans[::-1], sep='')


def robot_arms(N: int, XY: list) -> tuple:
	(odd, even) = (0, 0)
	max_dist = 0
	for (x, y) in XY:
		(ax, ay) = (abs(x), abs(y))
		if (ax + ay) % 2 == 0:
			even += 1
		else:
			odd += 1
		if max_dist < ax + ay:
			max_dist = ax + ay
	if odd == 0:
		arms = [1]
	elif even == 0:
		arms = []
	else:
		return ([], [])
	(tmp, sum_tmp) = (1, sum(arms))
	while sum_tmp < max_dist:
		arms.append(tmp)
		sum_tmp += tmp
		tmp <<= 1
	ops = []
	for (x, y) in XY:
		op = ''
		left_len = sum(arms)
		(nx, ny) = (x, y)
		for arm in reversed(arms):
			left_len -= arm
			if abs(nx + arm) + abs(ny) <= left_len:
				op = 'L' + op
				(nx, ny) = (nx + arm, ny)
			elif abs(nx - arm) + abs(ny) <= left_len:
				op = 'R' + op
				(nx, ny) = (nx - arm, ny)
			elif abs(nx) + abs(ny + arm) <= left_len:
				op = 'D' + op
				(nx, ny) = (nx, ny + arm)
			elif abs(nx) + abs(ny - arm) <= left_len:
				op = 'U' + op
				(nx, ny) = (nx, ny - arm)
		ops.append(op)
	return (arms, ops)

def __starting_point():
	N = int(input())
	XY = [tuple(map(int, input().split())) for _ in range(N)]
	ans = robot_arms(N, XY)
	if len(ans[0]) == 0:
		print(-1)
	else:
		(d, w) = ans
		print(len(d))
		print(' '.join(map(str, d)))
		for ww in w:
			print(ww)
__starting_point()


def cal(i, j):
	if i == 1 and j == 1:
		return 'R'
	elif i == 1 and j == 0:
		return 'U'
	elif i == 0 and j == 1:
		return 'D'
	elif i == 0 and j == 0:
		return 'L'
import sys
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
mod = sum(a[0]) % 2
for i in range(N):
	if sum(a[i]) % 2 != mod:
		print(-1)
		sys.exit()
if mod == 0:
	a = [[a[i][0] - 1, a[i][1]] for i in range(N)]
if mod == 0:
	print(32)
	print(1, end=' ')
	for i in range(30):
		print(2 ** i, end=' ')
	print(2 ** 30)
else:
	print(31)
	for i in range(30):
		print(2 ** i, end=' ')
	print(2 ** 30)
for i in range(N):
	[x, y] = a[i]
	u = bin((x + y + 2 ** 31 - 1) // 2)[2:].zfill(31)
	v = bin((x - y + 2 ** 31 - 1) // 2)[2:].zfill(31)
	if mod == 0:
		s = 'R'
	else:
		s = ''
	for i in range(30, -1, -1):
		s = s + cal(int(u[i]), int(v[i]))
	print(s)


n = int(input())
xy = [tuple((int(x) for x in input().split())) for _ in range(n)]
mod = (xy[0][0] + xy[0][1]) % 2
for (x, y) in xy:
	if (x + y) % 2 != mod:
		print(-1)
		return
print(33 - mod)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in xy:
	temp = []
	for d in D:
		if x >= y and x + y >= 0:
			temp.append('R')
			x -= d
		elif x < y and x + y >= 0:
			temp.append('U')
			y -= d
		elif x >= y and x + y < 0:
			temp.append('D')
			y += d
		else:
			temp.append('L')
			x += d
	print(''.join(temp))


N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]
odd = []
for (x, y) in P:
	dist = abs(x) + abs(y)
	odd.append(dist % 2 != 0)
valid = True
even = False
if all(odd):
	pass
elif not any(odd):
	even = True
else:
	valid = False
if valid:
	M = 31
	if even:
		print(M + 1)
		print(*[1 << m for m in range(M)] + [1])
	else:
		print(M)
		print(*[1 << m for m in range(M)])
	for (x, y) in P:
		u = x + y
		v = x - y
		if even:
			u += 1
			v += 1
		if u >= 0 and v >= 0:
			A = 'R'
			B = 'U'
			C = 'D'
			D = 'L'
		elif u >= 0 and v < 0:
			v *= -1
			A = 'U'
			B = 'R'
			C = 'L'
			D = 'D'
		elif u < 0 and v >= 0:
			u *= -1
			A = 'D'
			B = 'L'
			C = 'R'
			D = 'U'
		elif u < 0 and v < 0:
			u *= -1
			v *= -1
			A = 'L'
			B = 'D'
			C = 'U'
			D = 'R'
		ans = ''
		wa = ((1 << M) - 1 - u) // 2
		sa = ((1 << M) - 1 - v) // 2
		for i in range(M):
			check = str(wa >> i & 1) + str(sa >> i & 1)
			if check == '00':
				ans += A
			elif check == '01':
				ans += B
			elif check == '10':
				ans += C
			elif check == '11':
				ans += D
		if even:
			ans += 'L'
		print(ans)
else:
	print(-1)


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
if N != 1:
	a = abs(XY[0][0]) + abs(XY[0][1])
	flag = (XY[0][0] + XY[0][1]) % 2
for i in range(N - 1):
	b = abs(XY[i + 1][0]) + abs(XY[i + 1][1])
	a = max(a, b)
	if flag != (XY[i + 1][0] + XY[i + 1][1]) % 2:
		print(-1)
		return
m = 0
while a > 1:
	m += 1
	a = a // 2
d = []
for i in range(m + 3, -1, -1):
	d += [2 ** i]
if flag == 0:
	print(len(d) + 1)
	print(' '.join(map(str, [1] + d)))
else:
	print(len(d))
	print(' '.join(map(str, d)))

def string(X, Y):
	if (abs(X) + abs(Y)) % 2 == 0:
		ans = 'R'
		x = X - 1
		y = Y
	else:
		(x, y) = (X, Y)
		ans = str()
	for i in d:
		if abs(x - i) + abs(y) < i:
			ans += 'R'
			x = x - i
		elif abs(x + i) + abs(y) < i:
			ans += 'L'
			x = x + i
		elif abs(x) + abs(y - i) < i:
			ans += 'U'
			y = y - i
		elif abs(x) + abs(y + i) < i:
			ans += 'D'
			y = y + i
	return ans
for i in XY:
	print(string(i[0], i[1]))


inf = float('inf')
n = int(input())
coordinates = [tuple(map(int, input().split())) for _ in range(n)]
parity = None
can_make = True
for coordinate in coordinates:
	if parity is None:
		parity = sum(coordinate) % 2
	elif parity != sum(coordinate) % 2:
		can_make = False
		break
if not can_make:
	print(-1)
	exit()
if parity == 0:
	d = [pow(2, i) for i in range(31 + 1)] + [1]
else:
	d = [pow(2, i) for i in range(31 + 1)]
d.sort(reverse=True)
ans = []
for (x, y) in coordinates:
	u = x + y
	v = x - y
	(curu, curv) = (0, 0)
	ops = ''
	for dd in d:
		dist = inf
		op = ''
		(det_du, det_dv) = (0, 0)
		for (c, (du, dv)) in zip('LRDU', [(-1, -1), (1, 1), (-1, 1), (1, -1)]):
			t = abs(curu + du * dd - u) + abs(curv + dv * dd - v)
			if dist > t:
				op = c
				dist = t
				det_du = du
				det_dv = dv
		ops += op
		curu += det_du * dd
		curv += det_dv * dd
	if (curu, curv) == (u, v):
		ans.append(ops)
	else:
		print(-1)
print(len(d))
print(*d)
print(*ans, sep='\n')


import sys
N = int(input())
co = []
(x, y) = map(int, input().split())
co.append((x, y))
Amod = (x + y) % 2
flag = True
max_co = abs(x) + abs(y)
for i in range(N - 1):
	(x, y) = map(int, input().split())
	co.append((x, y))
	if Amod != (x + y) % 2:
		flag = False
	tmp = abs(x) + abs(y)
	max_co = max(max_co, tmp)
if flag is False:
	print(-1)
	return
ex2 = [1, 2, 4, 8, 16, 32]
expo = 32
while expo < max_co:
	expo *= 2
	ex2.append(expo)
ans_list = []
for (x, y) in co:
	if Amod == 0:
		x -= 1
		ans = 'R'
	else:
		ans = ''
	for arm in reversed(ex2):
		if abs(x) > abs(y):
			if x > 0:
				x -= arm
				ans = 'R' + ans
			else:
				x += arm
				ans = 'L' + ans
		elif y > 0:
			y -= arm
			ans = 'U' + ans
		else:
			y += arm
			ans = 'D' + ans
	ans_list.append(ans)
if Amod == 0:
	ex2.append(1)
print(len(ex2))
arm = ''
for a in ex2:
	arm += ' ' + str(a)
print(arm[1:])
for a in ans_list:
	print(a)


def d_robot_arms(N, Pos):
	ans = []
	pos = []
	parity = (abs(Pos[0][0]) + abs(Pos[0][1])) % 2
	for (x, y) in Pos:
		parity_current = (abs(x) + abs(y)) % 2
		if parity != parity_current:
			return -1
		pos.append([x + y, x - y])
	d = []
	for i in range(30, -1, -1):
		d.append(1 << i)
	if parity % 2 == 0:
		d.append(1)
	ans.append(str(len(d)))
	ans.append(' '.join(list(map(str, d))))
	for i in range(N):
		(xdir, ydir) = (0, 0)
		(xsum, ysum) = (0, 0)
		tmp = []
		for j in range(len(d)):
			if xsum <= pos[i][0]:
				xdir = 1
				xsum += d[j]
			else:
				xdir = -1
				xsum -= d[j]
			if ysum <= pos[i][1]:
				ydir = 1
				ysum += d[j]
			else:
				ydir = -1
				ysum -= d[j]
			if xdir == 1 and ydir == 1:
				tmp.append('R')
			elif xdir == 1 and ydir == -1:
				tmp.append('U')
			elif xdir == -1 and ydir == -1:
				tmp.append('L')
			else:
				tmp.append('D')
		ans.append(''.join(tmp))
	ans = '\n'.join(ans)
	return ans
N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(d_robot_arms(N, Pos))


from sys import exit
N = int(input())
Od = True
Ev = True
XY = []
for _ in range(N):
	(x, y) = map(int, input().split())
	if (x + y) % 2:
		Ev = False
	else:
		Od = False
	XY.append((x, y))
if not Od and (not Ev):
	print(-1)
	exit()
ans = [2 ** i for i in range(31)]
Sig = sum(ans)
if Ev:
	ans = [1] + ans
print(len(ans))
print(*ans)
for (x, y) in XY:
	if Ev:
		x -= 1
	pl = abs((Sig - (x + y)) // 2)
	mi = abs((Sig - (x - y)) // 2)
	RU = [1 if pl & 2 ** i else 0 for i in range(31)]
	RD = [1 if mi & 2 ** i else 0 for i in range(31)]
	ans = [None] * 31
	for j in range(31):
		if RU[j] and RD[j]:
			ans[j] = 'R'
		elif RD[j] and (not RU[j]):
			ans[j] = 'D'
		elif not RD[j] and RU[j]:
			ans[j] = 'U'
		else:
			ans[j] = 'L'
	ans = ''.join(ans)
	(xi, yi) = (0, 0)
	for (i, s) in enumerate(ans):
		if s == 'U':
			yi += 2 ** i
		if s == 'D':
			yi -= 2 ** i
		if s == 'R':
			xi += 2 ** i
		if s == 'L':
			xi -= 2 ** i
	if y != yi:
		ans = ans.translate(str.maketrans('UD', 'DU'))
	if x != xi:
		ans = ans.translate(str.maketrans('LR', 'RL'))
	if Ev:
		ans = 'R' + ans
	print(ans)


n = int(input())
raw = []
eo = []
h = 30
for _ in range(n):
	(x, y) = map(int, input().split())
	raw.append([x, y])
	eo.append((x + y) % 2)
if sum(eo) == 0:
	print(h + 2)
	d = [2 ** (h - i) for i in range(h + 1)]
	d.append(1)
	print(' '.join(map(str, d)))
elif sum(eo) == n:
	print(h + 1)
	d = [2 ** (h - i) for i in range(h + 1)]
	print(' '.join(map(str, d)))
else:
	print(-1)
	exit()
for xy in raw:
	(x, y) = xy
	scale = 2 ** h
	ans = ''
	while scale != 0:
		tmp = [[0, 0, 'U'], [0, 1, 'D'], [0, 2, 'R'], [0, 3, 'L']]
		tmp[0][0] = x ** 2 + (y - 1) ** 2
		tmp[1][0] = x ** 2 + (y + 1) ** 2
		tmp[2][0] = (x - 1) ** 2 + y ** 2
		tmp[3][0] = (x + 1) ** 2 + y ** 2
		(d, dr) = (min(tmp)[1], min(tmp)[2])
		ans += dr
		if d == 0:
			y -= scale
		elif d == 1:
			y += scale
		elif d == 2:
			x -= scale
		else:
			x += scale
		scale //= 2
	if x + y != 0:
		if y == 1:
			ans += 'U'
		elif y == -1:
			ans += 'D'
		elif x == 1:
			ans += 'R'
		else:
			ans += 'L'
	print(ans)


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
m = [0] * 2
for (i, j) in l:
	m[(i + j) % 2] += 1
if m[0] * m[1] > 0:
	print(-1)
	exit()
if m[1] > 0:
	arm = [2 ** i for i in range(32)]
else:
	arm = [1] + [2 ** i for i in range(32)]
print(len(arm))
print(*arm)
for (x, y) in l:
	ans = []
	nx = x
	ny = y
	for i in arm[::-1]:
		if abs(nx) >= abs(ny):
			if nx >= 0:
				ans.append('R')
				nx -= i
			else:
				ans.append('L')
				nx += i
		elif ny >= 0:
			ans.append('U')
			ny -= i
		else:
			ans.append('D')
			ny += i
	print(*ans[::-1], sep='')


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
num_type = sum(XY[0]) % 2
for xy in XY:
	if sum(xy) % 2 != num_type:
		print(-1)
		break
else:
	m = 40 - num_type
	print(m)
	D = [2 ** i for i in range(38, -1, -1)]
	if not num_type:
		D.append(1)
	print(' '.join(map(str, D)))
	for xy in XY:
		p = xy
		w = ''
		for i in range(m):
			if 0 <= p[0] - p[1] and 0 <= p[0] + p[1]:
				w += 'R'
				p[0] -= D[i]
			elif 0 > p[0] - p[1] and 0 <= p[0] + p[1]:
				w += 'U'
				p[1] -= D[i]
			elif 0 <= p[0] - p[1] and 0 > p[0] + p[1]:
				w += 'D'
				p[1] += D[i]
			else:
				w += 'L'
				p[0] += D[i]
		print(w)


import sys

def f(x, y, i):
	d = 1 << i
	if y > x and y > -x:
		return (x, y - d, 'U')
	elif y < x and y > -x:
		return (x - d, y, 'R')
	elif y < x and y < -x:
		return (x, y + d, 'D')
	else:
		return (x + d, y, 'L')
N = int(input())
X = []
Y = []
mx = 0
for i in range(N):
	(x, y) = [int(x) for x in input().split()]
	mx = max(abs(x) + abs(y), mx)
	X.append(x)
	Y.append(y)
s = (X[0] + Y[0]) % 2
for i in range(N):
	if s != (X[i] + Y[i]) % 2:
		print(-1)
		sys.exit(0)
if s == 0:
	X = [x - 1 for x in X]
D = []
d = 1
while d < mx:
	D.append(d)
	d = d * 2
m = len(D)
print(m if s != 0 else m + 1)
if s == 0:
	D = [1] + D
print(' '.join([str(d) for d in D]))
for i in range(N):
	(x, y) = (X[i], Y[i])
	dirs = []
	for j in range(m - 1, -1, -1):
		(x, y, dir) = f(x, y, j)
		dirs.append(dir)
	if s == 0:
		dirs.append('R')
	print(''.join(dirs[::-1]))


import math

def binary(n, m):
	lst = []
	while n != 0:
		lst.append(n % 2)
		n = n // 2
	lst = lst + [0] * (m - len(lst))
	return list(reversed(lst))

def calc(u, v, m):
	result = ''
	u_binary = binary(u, m)
	v_binary = binary(v, m)
	for i in range(m):
		if u_binary[i] == 1 and v_binary[i] == 1:
			result += 'R'
		elif u_binary[i] == 0 and v_binary[i] == 0:
			result += 'L'
		elif u_binary[i] == 1 and v_binary[i] == 0:
			result += 'U'
		else:
			result += 'D'
	return result
U = []
V = []
N = int(input())
(even, odd) = (0, 0)
M = 0
for p in range(N):
	(x, y) = map(int, input().split())
	u = x + y
	v = x - y
	U.append(u)
	V.append(v)
	M = max(M, abs(u), abs(v))
	if (x + y) % 2 == 0:
		even += 1
	else:
		odd += 1
if even >= 1 and odd >= 1:
	print(-1)
else:
	m = math.floor(math.log2(M)) + 1 if M != 0 else 1
	lst = [2 ** i for i in range(m - 1, -1, -1)]
	if odd == 0:
		lst.append(1)
	print(len(lst))
	print(' '.join(map(str, lst)))
	for (u, v) in zip(U, V):
		u = (u + 2 ** m - 1) // 2
		v = (v + 2 ** m - 1) // 2
		print(calc(u, v, m) + 'R' if odd == 0 else calc(u, v, m))


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
g = 39
a = []
if sum(xy[0]) % 2 == 0:
	a.append(1)
for i in range(g):
	a.append(1 << i)
g = len(a)
for (x, y) in xy:
	if (x + y) % 2 != sum(xy[0]) % 2:
		print(-1)
		return ()
print(g)
print(*a)

def f(s):
	t = s
	ans = []
	for i in a[::-1]:
		if abs(t - i) < abs(t + i):
			ans.append(-i)
			t -= i
		else:
			ans.append(i)
			t += i
	return ans[::-1]
for (x, y) in xy:
	xpy = f(-(x + y))
	xmy = f(-(x - y))
	ans = ''
	for (p, m) in zip(xpy, xmy):
		if 0 < p and 0 < m:
			ans += 'R'
		if p < 0 and m < 0:
			ans += 'L'
		if 0 < p and m < 0:
			ans += 'U'
		if p < 0 and 0 < m:
			ans += 'D'
	print(ans)


N = int(input())
(X, Y) = ([], [])
(even, odd) = (0, 0)
for i in range(N):
	(x, y) = list(map(int, input().split()))
	X.append(x)
	Y.append(y)
	if (x + y) % 2 == 0:
		even += 1
	else:
		odd += 1

def calc(x, y):
	(nowx, nowy) = (0, 0)
	t = ''
	for i in range(30, -1, -1):
		if nowx < x:
			nowx += 2 ** i
			p = 1
		else:
			nowx -= 2 ** i
			p = -1
		if nowy < y:
			nowy += 2 ** i
			q = 1
		else:
			nowy -= 2 ** i
			q = -1
		if p == 1 and q == 1:
			t += 'R'
		elif p == 1 and q == -1:
			t += 'U'
		elif p == -1 and q == 1:
			t += 'D'
		else:
			t += 'L'
	return t
if even >= 1 and odd >= 1:
	print(-1)
	return
else:
	d = [2 ** i for i in range(30, -1, -1)]
	if even == 0:
		print(31)
		print(' '.join(map(str, d)))
		for i in range(N):
			print(calc(X[i] + Y[i], X[i] - Y[i]))
	else:
		print(32)
		d.append(1)
		print(' '.join(map(str, d)))
		for i in range(N):
			print(calc(X[i] + Y[i] - 1, X[i] - Y[i] - 1) + 'R')


import sys

def I():
	return int(sys.stdin.readline().rstrip())

def MI():
	return map(int, sys.stdin.readline().rstrip().split())
N = I()
(A, B) = ([], [])
for i in range(N):
	(x, y) = MI()
	if i == 0:
		A.append(x - y)
		B.append(x + y)
		r = (x - y) % 2
	else:
		if (x - y) % 2 != r:
			print(-1)
			exit()
		A.append(x - y)
		B.append(x + y)
if r == 1:
	ANS = [[''] * 31 for _ in range(N)]
	for i in range(N):
		(a, b) = (A[i], B[i])
		for j in range(30, -1, -1):
			if a > 0 and b > 0:
				a -= 2 ** j
				b -= 2 ** j
				ANS[i][j] = 'R'
			elif a > 0 and b < 0:
				a -= 2 ** j
				b += 2 ** j
				ANS[i][j] = 'D'
			elif a < 0 and b > 0:
				a += 2 ** j
				b -= 2 ** j
				ANS[i][j] = 'U'
			else:
				a += 2 ** j
				b += 2 ** j
				ANS[i][j] = 'L'
	print(31)
	print(*[2 ** i for i in range(31)])
	for i in range(N):
		print(''.join(ANS[i]))
else:
	ANS = [[''] * 31 + ['R'] for _ in range(N)]
	for i in range(N):
		(a, b) = (A[i] - 1, B[i] - 1)
		for j in range(30, -1, -1):
			if a > 0 and b > 0:
				a -= 2 ** j
				b -= 2 ** j
				ANS[i][j] = 'R'
			elif a > 0 and b < 0:
				a -= 2 ** j
				b += 2 ** j
				ANS[i][j] = 'D'
			elif a < 0 and b > 0:
				a += 2 ** j
				b -= 2 ** j
				ANS[i][j] = 'U'
			else:
				a += 2 ** j
				b += 2 ** j
				ANS[i][j] = 'L'
	print(32)
	print(*[2 ** i for i in range(31)] + [1])
	for i in range(N):
		print(''.join(ANS[i]))


N = int(input())
X = []
Y = []
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	X.append(x)
	Y.append(y)
if len(set([(x + y) % 2 for (x, y) in zip(X, Y)])) != 1:
	print(-1)
	return

def directions_str(fx, fy, tx, ty, arm):
	if fx == tx and fy == ty:
		return ''
	if abs(fx - arm - tx) + abs(fy - ty) < arm:
		return 'L' + directions_str(fx=fx - arm, fy=fy, tx=tx, ty=ty, arm=arm // 2)
	if abs(fx + arm - tx) + abs(fy - ty) < arm:
		return 'R' + directions_str(fx=fx + arm, fy=fy, tx=tx, ty=ty, arm=arm // 2)
	if abs(fx - tx) + abs(fy - arm - ty) < arm:
		return 'D' + directions_str(fx=fx, fy=fy - arm, tx=tx, ty=ty, arm=arm // 2)
	if abs(fx - tx) + abs(fy + arm - ty) < arm:
		return 'U' + directions_str(fx=fx, fy=fy + arm, tx=tx, ty=ty, arm=arm // 2)
arms = []
for n in range(39):
	arms.append(2 ** n)
	if 2 ** n > 10 ** 9:
		break
arms.sort(reverse=True)
if (X[0] + Y[0]) % 2 == 1:
	print(len(arms))
	print(' '.join(map(str, arms)))
	for (x, y) in zip(X, Y):
		print(directions_str(fx=0, fy=0, tx=x, ty=y, arm=arms[0]))
else:
	arms.append(1)
	print(len(arms))
	print(' '.join(map(str, arms)))
	for (x, y) in zip(X, Y):
		print(directions_str(fx=0, fy=0, tx=x, ty=y + 1, arm=arms[0]) + 'D')


N = int(input())
point = []
parity = {}
for _ in range(N):
	(x, y) = map(int, input().split())
	point.append((x, y))
	parity[(x + y) % 2] = 1
if len(set(parity)) == 2:
	print('-1')
else:
	m = 38
	parity = 1 if 1 in parity else 0
	print(m + 1 - parity)
	if parity == 1:
		print(*[1 << i for i in range(m)])
	else:
		print(1, *[1 << i for i in range(m)])

	def arm(x, y, m):
		if abs(x) >= abs(y):
			if x >= 0:
				return ('R', x - (1 << m), y)
			else:
				return ('L', x + (1 << m), y)
		elif y >= 0:
			return ('U', x, y - (1 << m))
		else:
			return ('D', x, y + (1 << m))
	for (x, y) in point:
		ans = []
		for i in range(m - 1, -1, -1):
			(mode, x, y) = arm(x, y, i)
			ans.append(mode)
		if parity == 0:
			if x == 1:
				ans.append('R')
			elif x == -1:
				ans.append('L')
			elif y == 1:
				ans.append('U')
			elif y == -1:
				ans.append('D')
		print(''.join(ans[::-1]))


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
dist_max = 0
for (i, (x, y)) in enumerate(xy):
	dist = abs(x) + abs(y)
	if i == 0:
		parity = dist % 2
	elif dist % 2 != parity:
		print(-1)
		exit()
	if parity == 0:
		x -= 1
		dist = abs(x) + abs(y)
	dist_max = max(dist_max, dist)
	xy[i] = [x, y]
d = []
d_i = 1
for i in range(40):
	if d_i > dist_max:
		break
	d.append(d_i)
	d_i *= 2
d = sorted(d, reverse=True)
if parity == 0:
	d.append(1)
print(len(d))
print(' '.join(map(str, d)))
for (x, y) in xy:
	ans = ''
	prev = 0
	for d_i in d:
		if prev == d_i and d_i == 1:
			ans += 'R'
			break
		if x + y < 0:
			if x - y < 0:
				ans += 'L'
				x += d_i
			else:
				ans += 'D'
				y += d_i
		elif x - y < 0:
			ans += 'U'
			y -= d_i
		else:
			ans += 'R'
			x -= d_i
		prev = d_i
	print(ans)


N = int(input())
Point = [list(map(int, input().split())) for i in range(N)]
if len(set([(abs(x) + abs(y)) % 2 for (x, y) in Point])) == 2:
	print(-1)
	return
Arms = [2 ** i for i in reversed(list(range(39)))]
if (abs(Point[0][0]) + abs(Point[0][1])) % 2 == 0:
	Arms.append(1)
print(len(Arms))
print(' '.join(map(str, Arms)))
for (x, y) in Point:
	ans = ''
	for length in Arms:
		(min_diff, tmp_s) = (float('inf'), '')
		(next_x, next_y) = (None, None)
		for (order, dx, dy) in (('L', 1, 0), ('R', -1, 0), ('D', 0, 1), ('U', 0, -1)):
			(tmp_x, tmp_y) = (x + length * dx, y + length * dy)
			diff = abs(tmp_x) + abs(tmp_y)
			if diff < min_diff:
				min_diff = diff
				tmp_s = order
				(next_x, next_y) = (tmp_x, tmp_y)
		ans += tmp_s
		(x, y) = (next_x, next_y)
	print(ans)


import sys
N = int(input())
XY = [tuple(map(int, input().split())) for _ in range(N)]
mod = sum(XY[0]) % 2
if any((mod != (x + y) % 2 for (x, y) in XY)):
	print(-1)
	return
m = 33 - mod
print(m)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in XY:
	w = ''
	for d in D:
		if 0 <= x - y and 0 <= x + y:
			w += 'R'
			x -= d
		elif 0 > x - y and 0 <= x + y:
			w += 'U'
			y -= d
		elif 0 <= x - y and 0 > x + y:
			w += 'D'
			y += d
		else:
			w += 'L'
			x += d
	print(w)


import sys
N = int(input())
XY = list()
for i in range(N):
	XY.append(list(map(int, input().split(' '))))
eo = sum(XY[0]) % 2
for xy in XY:
	if sum(xy) % 2 != eo:
		print(-1)
		return
m = 40 - eo
print(m)
D = [2 ** i for i in range(38, -1, -1)]
if eo == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in XY:
	w = ''
	for i in range(m):
		if 0 <= x - y and 0 <= x + y:
			w += 'R'
			x -= D[i]
		elif 0 > x - y and 0 <= x + y:
			w += 'U'
			y -= D[i]
		elif 0 <= x - y and 0 > x + y:
			w += 'D'
			y += D[i]
		else:
			w += 'L'
			x += D[i]
	print(w)


def get_check(num, place):
	dist = abs(place[0][0]) + abs(place[0][1])
	check_flg = dist
	for i in range(num - 1):
		dist_now = abs(place[i + 1][0]) + abs(place[i + 1][1])
		if dist % 2 != dist_now % 2:
			check_flg = 0
			break
		if check_flg < dist_now:
			check_flg = dist_now
	return check_flg

def start_process(num, place):
	check_flg = get_check(num, place)
	if check_flg:
		seeds = [2 ** (31 - i) for i in range(32)]
		if check_flg % 2 == 0:
			seeds.append(1)
		print(len(seeds))
		print(' '.join(map(str, seeds)))
		for (x, y) in place:
			for k in seeds:
				if abs(x) > abs(y):
					if x > 0:
						res = 'R'
						x -= k
					else:
						res = 'L'
						x += k
				elif y > 0:
					res = 'U'
					y -= k
				else:
					res = 'D'
					y += k
				print(res, end='')
			print('')
	else:
		print(-1)

def main():
	num = int(input())
	place = [list(map(int, input().split())) for i in range(num)]
	start_process(num, place)

def __starting_point():
	main()
__starting_point()


N = int(input())
XY = []
for _ in range(N):
	(x, y) = map(int, input().split())
	XY.append((x + y, x - y))
if any((XY[0][0] % 2 != xy[0] % 2 for xy in XY)):
	print(-1)
	exit()
odd = XY[0][0] % 2 == 1
if odd:
	d = [2 ** i for i in range(30, -1, -1)]
else:
	d = [2 ** i for i in range(30, -1, -1)] + [1]
print(len(d))
print(*d)
for (xpy, xmy) in XY:
	s = ''
	p = 0
	m = 0
	for di in d:
		ps = 1 if p <= xpy else -1
		ms = 1 if m <= xmy else -1
		p += ps * di
		m += ms * di
		if ps == 1:
			s += 'R' if ms == 1 else 'U'
		else:
			s += 'D' if ms == 1 else 'L'
	print(s)


import sys
N = int(input())
XY = [[int(_) for _ in input().split()] for i in range(N)]
mc = [0, 0]
maxl = 0
for (x, y) in XY:
	l = abs(x) + abs(y)
	maxl = max(maxl, l)
	mc[l % 2] += 1
if mc[0] > 0 and mc[1] > 0:
	print(-1)
	sys.exit()

def calc(sx, sy, ex, ey, d):
	(dx, dy) = (ex - sx, ey - sy)
	(rx, ry) = (dx - dy, dx + dy)
	if rx > 0:
		if ry > 0:
			(d, x, y) = ('R', sx + d, sy)
		else:
			(d, x, y) = ('D', sx, sy - d)
	elif ry > 0:
		(d, x, y) = ('U', sx, sy + d)
	else:
		(d, x, y) = ('L', sx - d, sy)
	return (d, x, y)
import math
l = math.ceil(math.log(maxl + 1, 2))
ms = [2 ** (l - i - 1) for i in range(l)]
rms = ms
if mc[0] > 0:
	rms = [1] + ms
print(len(rms))
print(*rms)
for (ex, ey) in XY:
	(x, y) = (0, 0)
	w = ''
	if mc[0] > 0:
		w = 'R'
		x += 1
	for m in ms:
		(d, x, y) = calc(x, y, ex, ey, m)
		w += d
	print(w)


import sys
import itertools
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
c = ['R', 'U', 'L', 'D']
n = int(input())
x = []
y = []
for i in range(n):
	(xi, yi) = map(int, input().split())
	x.append(xi)
	y.append(yi)
parity = None
for i in range(n):
	if i == 0:
		parity = (x[i] + y[i]) % 2
	elif (x[i] + y[i]) % 2 != parity:
		print(-1)
		sys.exit()
print(40)
d = []
for i in range(20):
	d.append(3 ** i)
	d.append(3 ** i)
d[1] += parity
print(*d)
d = [1] * 40
d[1] += parity
for i in range(n):
	for m in range(20):
		for (j, k) in itertools.product(range(4), range(4)):
			xnew = x[i] - (d[2 * m] * dx[j] + d[2 * m + 1] * dx[k])
			ynew = y[i] - (d[2 * m] * dy[j] + d[2 * m + 1] * dy[k])
			if xnew % 3 == 0 and ynew % 3 == 0:
				x[i] = xnew // 3
				y[i] = ynew // 3
				print(c[j] + c[k], end='')
				break
	print('')


N = int(input())
S = [0] * N
X = [0] * N
Y = [0] * N
for i in range(N):
	(X[i], Y[i]) = map(int, input().split())
	S[i] = X[i] + Y[i]
	if (S[i] - S[0]) % 2 != 0:
		print(-1)
		return
nums = []
for i in range(30, -1, -1):
	nums.append(1 << i)
if S[0] % 2 == 0:
	nums.append(1)
m = len(nums)
print(m)
print(*nums)
for i in range(N):
	u = X[i] + Y[i]
	v = X[i] - Y[i]
	for num in nums:
		if u >= 0:
			if v >= 0:
				print('R', end='')
				u -= num
				v -= num
			else:
				print('U', end='')
				u -= num
				v += num
		elif v >= 0:
			print('D', end='')
			u += num
			v -= num
		else:
			print('L', end='')
			u += num
			v += num
	print()
print()


def pow2(i):
	ret = 1
	while i != 1:
		i >>= 1
		ret <<= 1
	return ret
m = int(input())
points = []
max2 = -1
flag = True
bias = -1
for i in range(m):
	point = list(map(int, input().split()))
	dis = abs(point[0]) + abs(point[1])
	if dis > max2:
		max2 = dis
	if bias != -1 and dis % 2 != bias % 2:
		flag = False
	if dis % 2 == 0:
		point[0] -= 1
	points.append(tuple(point))
	bias = dis % 2
if flag == False:
	print('-1')
	exit(0)
bias = max2 % 2
max2 = pow2(max2)
diss = []
dirctions = [''] * m
while max2 > 0:
	for i in range(m):
		point = points[i]
		if point[1] > point[0] and point[1] > -point[0]:
			dirctions[i] = 'U' + dirctions[i]
			points[i] = (point[0], point[1] - max2)
		elif point[1] > point[0] and point[1] < -point[0]:
			dirctions[i] = 'L' + dirctions[i]
			points[i] = (point[0] + max2, point[1])
		elif point[1] < point[0] and point[1] > -point[0]:
			dirctions[i] = 'R' + dirctions[i]
			points[i] = (point[0] - max2, point[1])
		else:
			dirctions[i] = 'D' + dirctions[i]
			points[i] = (point[0], point[1] + max2)
	diss = [max2] + diss
	max2 >>= 1
if bias == 0:
	diss = [1] + diss
	for i in range(m):
		dirctions[i] = 'R' + dirctions[i]
print(len(diss))
for d in diss:
	print(str(d), end=' ')
print('')
for d in dirctions:
	print(d)


def solution(x, y):
	ans = ''
	(nowx, nowy) = (0, 0)
	preX = [0] * 31
	preY = [0] * 31
	for i in range(31):
		if nowx < x:
			nowx += 2 ** (30 - i)
			preX[i] = 1
		else:
			nowx -= 2 ** (30 - i)
			preX[i] = -1
		if nowy < y:
			nowy += 2 ** (30 - i)
			preY[i] = 1
		else:
			nowy -= 2 ** (30 - i)
			preY[i] = -1
	for i in range(31):
		if preX[i] == -1 and preY[i] == -1:
			ans += 'L'
		elif preX[i] == 1 and preY[i] == 1:
			ans += 'R'
		elif preX[i] == -1 and preY[i] == 1:
			ans += 'D'
		else:
			ans += 'U'
	return ans
N = int(input())
X = [0] * N
Y = [0] * N
(x, y) = map(int, input().split())
X[0] = x
Y[0] = y
evod = (x + y) % 2
Flag = True
for i in range(1, N):
	(x, y) = map(int, input().split())
	X[i] = x
	Y[i] = y
	if (x + y) % 2 != evod:
		Flag = False
if Flag:
	D = [2 ** i for i in range(30, -1, -1)]
	if evod == 1:
		print(31)
		print(' '.join(map(str, D)))
		for i in range(N):
			print(solution(X[i] + Y[i], X[i] - Y[i]))
	else:
		print(32)
		D.append(1)
		print(' '.join(map(str, D)))
		for i in range(N):
			print(solution(X[i] + Y[i] - 1, X[i] - 1 - Y[i]) + 'R')
else:
	print(-1)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
m = 39
ans = []
if sum(xy[0]) % 2 == 0:
	ans.append(1)
for i in range(m):
	ans.append(2 ** i)
c = sum(xy[0]) % 2
for (x, y) in xy:
	if (x + y) % 2 != c:
		exit(print(-1))
print(len(ans))
print(*ans[::-1])

def chk(s):
	a = []
	for d in ans[::-1]:
		if abs(s - d) < abs(s + d):
			a.append(-1)
			s -= d
		else:
			a.append(1)
			s += d
	return a
(xpy, xmy) = ([], [])
for (x, y) in xy:
	xpy = chk(x + y)
	xmy = chk(x - y)
	s = []
	for (p, m) in zip(xpy, xmy):
		if p == 1 and m == 1:
			s.append('L')
		if p == -1 and m == -1:
			s.append('R')
		if p == 1 and m == -1:
			s.append('D')
		if p == -1 and m == 1:
			s.append('U')
	print(*s, sep='')


N = int(input())
p = [[int(i) for i in input().split()] for i in range(N)]
p_copy = list(p)
p_copy.sort(key=lambda x: x[0] + x[1])
length = abs(p_copy[N - 1][0]) + abs(p_copy[N - 1][1])
if length % 2 == 0:
	edge = [1]
	a = 1
	while a < length:
		edge.append(a)
		a = 2 * a
	edge.reverse()
else:
	edge = []
	a = 1
	while a < length:
		edge.append(a)
		a = 2 * a
	edge.reverse()
if len(edge) > 40 or edge[len(edge) - 1] > 10 ** 12:
	print(-1)
	exit()
w = [''] * N
for n in range(N):
	(x, y) = (p[n][0], p[n][1])
	if (x + y) % 2 != length % 2:
		print(-1)
		exit()
	else:
		(a, b) = (0, 0)
		for e in edge:
			R = abs(x - (a + e)) + abs(y - b)
			L = abs(x - (a - e)) + abs(y - b)
			U = abs(x - a) + abs(y - (b + e))
			D = abs(x - a) + abs(y - (b - e))
			if min([R, L, U, D]) == R:
				a += e
				w[n] += 'R'
			elif min([R, L, U, D]) == L:
				a += -e
				w[n] += 'L'
			elif min([R, L, U, D]) == U:
				b += e
				w[n] += 'U'
			else:
				b += -e
				w[n] += 'D'
print(len(edge))
map_edge = map(str, edge)
print(' '.join(map_edge))
for n in range(N):
	print(w[n])


from functools import reduce
import math
n = int(input())
coord = [tuple(map(int, input().split())) for i in range(n)]
(x, y) = coord[0]
p = x + y & 1
limit = 0
for (x, y) in coord:
	if p != x + y & 1:
		print(-1)
		return
	lim = abs(x) + abs(y)
	if lim > limit:
		limit = lim
limit = round(math.log2(limit))
if p == 1:
	d = [2 ** i for i in reversed(range(limit + 1))]
else:
	d = [1] + [2 ** i for i in reversed(range(limit + 1))]
print(len(d))
print(reduce(lambda acc, dist: str(acc) + ' ' + str(dist), d))
for (x, y) in coord:
	u = x + y
	v = x - y
	command = ''
	for i in range(len(d)):
		if u >= 0 and v >= 0:
			command += 'R'
			u -= d[i]
			v -= d[i]
		elif u >= 0 > v:
			command += 'U'
			u -= d[i]
			v += d[i]
		elif u < 0 <= v:
			command += 'D'
			u += d[i]
			v -= d[i]
		elif u < 0 and v < 0:
			command += 'L'
			u += d[i]
			v += d[i]
	print(command)


n = int(input())
xys = [list(map(int, input().split())) for _ in range(n)]
p = sum(xys[0]) % 2
for xy in xys:
	(x, y) = xy
	if (x + y) % 2 != p:
		print(-1)
		exit()
if p == 0:
	d = [1]
else:
	d = []
d += [2 ** k for k in range(30 + 1)]
m = len(d)
ws = [['' for _ in range(m)] for _ in range(n)]
idx = 0
for xy in xys:
	(x, y) = xy
	for k in sorted(range(m), reverse=True):
		R = abs(x - d[k]) + abs(y)
		L = abs(x + d[k]) + abs(y)
		U = abs(x) + abs(y - d[k])
		D = abs(x) + abs(y + d[k])
		min_v = min(R, L, U, D)
		if min_v == R:
			ws[idx][k] = 'R'
			x -= d[k]
		elif min_v == L:
			ws[idx][k] = 'L'
			x += d[k]
		elif min_v == U:
			ws[idx][k] = 'U'
			y -= d[k]
		else:
			ws[idx][k] = 'D'
			y += d[k]
	idx += 1
print(m)
print(*d)
for w in ws:
	print(''.join(w))


def solve(x, y, d, m):
	ret = ''
	for i in range(m):
		if x + y >= 0 and x - y >= 0:
			ret += 'R'
			x -= d[i]
		elif x + y >= 0 and x - y < 0:
			ret += 'U'
			y -= d[i]
		elif x + y < 0 and x - y >= 0:
			ret += 'D'
			y += d[i]
		else:
			ret += 'L'
			x += d[i]
	print(ret)

def main():
	m = 34
	(X, Y, d) = ([], [], [])
	for i in range(32, 0, -1):
		d += [2 ** i]
	d += [1]
	N = int(input())
	(even, odd) = (0, 0)
	for i in range(N):
		(x, y) = list(map(int, input().split()))
		X += [x]
		Y += [y]
		if (abs(x) + abs(y)) % 2 == 0:
			even += 1
		else:
			odd += 1
	if even and odd:
		print(-1)
		return 0
	if odd:
		m -= 1
	else:
		d += [1]
	print(m)
	print(' '.join(map(str, d)))
	for i in range(N):
		solve(X[i], Y[i], d, m)
main()


import sys
N = int(input())
coord = [tuple(map(int, input().split())) for _ in range(N)]
parity = (coord[0][0] + coord[0][1]) % 2
flag = False
for c in coord[1:]:
	if (c[0] + c[1]) % 2 != parity:
		flag = True
		break
if flag:
	print(-1)
	return
D = [2 ** (31 - i) for i in range(32)]
if parity == 0:
	D.append(1)
print(len(D))
print(*D, sep=' ')
for c in coord:
	w = ''
	pos = [0, 0]
	for d in D:
		dif = [c[0] - pos[0], c[1] - pos[1]]
		cands = [(abs(dif[0] - d) + abs(dif[1]), 'R'), (abs(dif[0] + d) + abs(dif[1]), 'L'), (abs(dif[0]) + abs(dif[1] - d), 'U'), (abs(dif[0]) + abs(dif[1] + d), 'D')]
		select = min(cands)
		w += select[1]
		if select[1] == 'R':
			pos[0] += d
		elif select[1] == 'L':
			pos[0] -= d
		elif select[1] == 'U':
			pos[1] += d
		else:
			pos[1] -= d
	print(w)


N = int(input())
XY = []
for i in range(N):
	XY.append(list(map(int, input().split())))
mr = abs(XY[0][0]) + abs(XY[0][1])
for i in range(1, N):
	if abs(XY[i][0]) + abs(XY[i][1]) > mr:
		mr = abs(XY[i][0]) + abs(XY[i][1])
import math
m = int(math.log(mr, 2) // 1 + 1)
g = (XY[0][0] + XY[0][1]) % 2
cnt = 0
for i in range(N):
	if (XY[i][0] + XY[i][1]) % 2 == g:
		cnt += 1
if cnt != N:
	print(-1)
elif g == 1:
	W = [''] * N
	for i in range(N):
		for j in range(m):
			if abs(XY[i][0]) >= abs(XY[i][1]) and XY[i][0] >= 0:
				W[i] += 'R'
				XY[i][0] -= 2 ** (m - j - 1)
			elif abs(XY[i][0]) >= abs(XY[i][1]) and XY[i][0] < 0:
				W[i] += 'L'
				XY[i][0] += 2 ** (m - j - 1)
			elif abs(XY[i][0]) < abs(XY[i][1]) and XY[i][1] >= 0:
				W[i] += 'U'
				XY[i][1] -= 2 ** (m - j - 1)
			elif abs(XY[i][0]) < abs(XY[i][1]) and XY[i][1] < 0:
				W[i] += 'D'
				XY[i][1] += 2 ** (m - j - 1)
	print(m)
	for i in range(m):
		print(2 ** i, end=' ')
	print()
	for j in range(N):
		print(W[j][::-1])
else:
	for i in range(N):
		XY[i][0] += 1
	W = [''] * N
	for i in range(N):
		for j in range(m):
			if abs(XY[i][0]) >= abs(XY[i][1]) and XY[i][0] >= 0:
				W[i] += 'R'
				XY[i][0] -= 2 ** (m - j - 1)
			elif abs(XY[i][0]) >= abs(XY[i][1]) and XY[i][0] < 0:
				W[i] += 'L'
				XY[i][0] += 2 ** (m - j - 1)
			elif abs(XY[i][0]) < abs(XY[i][1]) and XY[i][1] >= 0:
				W[i] += 'U'
				XY[i][1] -= 2 ** (m - j - 1)
			elif abs(XY[i][0]) < abs(XY[i][1]) and XY[i][1] < 0:
				W[i] += 'D'
				XY[i][1] += 2 ** (m - j - 1)
	print(m + 1)
	print(1, end=' ')
	for i in range(m):
		print(2 ** i, end=' ')
	print()
	for j in range(N):
		W[j] += 'L'
		print(W[j][::-1])


def solve(x, y, d, m):
	ret = ''
	dx = [-1, 0, 0, 1]
	dy = [0, -1, 1, 0]
	mode = ['R', 'U', 'D', 'L']
	for i in range(m):
		dir = 0
		t = abs(x + d[i] * dx[0]) + abs(y + d[i] * dy[0])
		for j in range(4):
			nx = x + d[i] * dx[j]
			ny = y + d[i] * dy[j]
			if abs(nx) + abs(ny) < t:
				t = abs(nx) + abs(ny)
				dir = j
		x = x + d[i] * dx[dir]
		y = y + d[i] * dy[dir]
		ret += mode[dir]
	print(ret)

def main():
	m = 34
	(X, Y, d) = ([], [], [])
	for i in range(32, 0, -1):
		d += [2 ** i]
	d += [1]
	N = int(input())
	(even, odd) = (0, 0)
	for i in range(N):
		(x, y) = map(int, input().split())
		X += [x]
		Y += [y]
		if (abs(x) + abs(y)) % 2 == 0:
			even += 1
		else:
			odd += 1
	if even and odd:
		print(-1)
		return 0
	if odd:
		m -= 1
	else:
		d += [1]
	print(m)
	print(' '.join(map(str, d)))
	for i in range(N):
		solve(X[i], Y[i], d, m)
main()


n = int(input())
P = []
M = []
for _ in range(n):
	(x, y) = map(int, input().split())
	P.append((x, y))
	M.append((x + y) % 2)
if len(set(M)) == 2:
	print(-1)
	return
D = [1 << i for i in range(31, -1, -1)]
if M[0] == 0:
	D.append(1)
print(len(D))
print(*D, sep=' ')
for (x, y) in P:
	a = []
	for d in D:
		if abs(x) > abs(y):
			if x < 0:
				a.append('L')
				x += d
			else:
				a.append('R')
				x -= d
		elif y < 0:
			a.append('D')
			y += d
		else:
			a.append('U')
			y -= d
	print(*a, sep='')


N = int(input())
targets = [list(map(int, input().split())) for _ in range(N)]
mod_1st = sum(targets[0]) % 2
if not all((sum(t) % 2 == mod_1st for t in targets[1:])):
	print(-1)
	exit(0)
mod = mod_1st
print(33 - mod)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in targets:
	temp = []
	u = x + y
	v = x - y
	for d in D:
		if u >= 0:
			if v >= 0:
				temp.append('R')
				u -= d
				v -= d
			elif v < 0:
				temp.append('U')
				u -= d
				v += d
		elif u < 0:
			if v >= 0:
				temp.append('D')
				u += d
				v -= d
			elif v < 0:
				temp.append('L')
				u += d
				v += d
	print(''.join(temp))


(n, *t) = map(int, open(0).read().split())
(*z,) = zip(t[::2], t[1::2])
s = set(((a + b) % 2 for (a, b) in z))
if len(s) > 1:
	print(-1)
	return
(s, *_) = s
d = [2 ** (38 - i) for i in range(39)] + [1] * (s < 1)
print(len(d), *d)
for (a, b) in z:
	x = y = 0
	o = ''
	for i in d:
		if abs(a - x) > abs(b - y):
			f = a - x > 0
			o += 'LR'[f]
			x += i * f or -i
		else:
			f = b - y > 0
			o += 'DU'[f]
			y += i * f or -i
	print(o)


N = int(input())
XY = [tuple(map(int, input().split())) for _ in range(N)]
R = [abs(x - y) & 1 for (x, y) in XY]
if not all((R[0] == r for r in R[1:])):
	print(-1)
	return
RM = max((abs(x) + abs(y) for (x, y) in XY))
D = [1 << i for i in range(32, -1, -1)]
if RM & 1 == 0:
	D.append(1)
W = ['' for _ in range(N)]
for d in D:
	for i in range(N):
		(x, y) = XY[i]
		if abs(x) > abs(y):
			if x > 0:
				x -= d
				W[i] += 'R'
			else:
				x += d
				W[i] += 'L'
		elif y > 0:
			y -= d
			W[i] += 'U'
		else:
			y += d
			W[i] += 'D'
		XY[i] = (x, y)
print(len(D))
print(*D)
print(*W, sep='\n')


import sys
input = sys.stdin.readline
import bisect
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
r = (XY[0][0] + XY[0][1]) % 2
for i in range(N):
	if r != (XY[i][0] + XY[i][1]) % 2:
		print(-1)
		sys.exit()
sumtwo = []
mul = 2
for i in range(31):
	sumtwo.append(mul - 1)
	mul *= 2
maxtwo = 0
i_two = 0
for i in range(N):
	if maxtwo < abs(XY[i][0]) + abs(XY[i][1]):
		i_two = bisect.bisect_left(sumtwo, abs(XY[i][0]) + abs(XY[i][1]))
		maxtwo = sumtwo[i_two]
ans = [2 ** i for i in range(i_two + 1)]
if r == 0:
	ans = [1] + ans
	i_two += 1
print(i_two + 1)
print(*ans)
ans.reverse()
for i in range(N):
	ans2 = []
	(nowx, nowy) = XY[i]
	for j in range(i_two + 1):
		if abs(nowx) < abs(nowy):
			if nowy < 0:
				ans2.append('D')
				nowy += ans[j]
			else:
				ans2.append('U')
				nowy -= ans[j]
		elif nowx < 0:
			ans2.append('L')
			nowx += ans[j]
		else:
			ans2.append('R')
			nowx -= ans[j]
	ans2.reverse()
	print(''.join(ans2))


import sys

def 解():
	iN = int(input())
	aP = [[int(_) for _ in sLine.rstrip('\n').split()] for sLine in sys.stdin.readlines()]
	iMod = sum(aP[0]) % 2
	for i in range(1, iN):
		if sum(aP[i]) % 2 != iMod:
			print('-1')
			return
	i最遠 = max([abs(iX) + abs(iY) for (iX, iY) in aP])
	a腕 = [1]
	if iMod == 0:
		a腕 = [1, 1]
	for i in range(32):
		a腕.append(a腕[-1] * 2)
		if i最遠 // 2 < a腕[-1]:
			break
	a腕.reverse()
	iLen腕 = len(a腕)
	aRet = []
	for (iX, iY) in aP:
		aCommand = []
		for i in range(iLen腕):
			if abs(iX) > abs(iY):
				if iX < 0:
					iX += a腕[i]
					aCommand.append('L')
				else:
					iX -= a腕[i]
					aCommand.append('R')
			elif iY < 0:
				iY += a腕[i]
				aCommand.append('D')
			else:
				iY -= a腕[i]
				aCommand.append('U')
		aRet.append(''.join(aCommand))
	print(iLen腕)
	print(' '.join([str(_) for _ in a腕]))
	sys.stdout.write('\n'.join(aRet) + '\n')

def __starting_point():
	解()
__starting_point()


N = int(input())
Q = [list(map(int, input().split())) for i in range(N)]
tmp = set()
for (X, Y) in Q:
	tmp.add((X + Y) % 2)
if len(tmp) != 1:
	print(-1)
	exit()
D = [2 ** i for i in range(30, -1, -1)]
if 0 in tmp:
	D.append(1)
print(len(D))
print(' '.join(map(str, D)))
move = [(1, 0, 'R'), (-1, 0, 'L'), (0, 1, 'U'), (0, -1, 'D')]
for (X, Y) in Q:
	(nx, ny) = (0, 0)
	ans = ''
	for d in D:
		tmp_move_ans = ''
		tmp_move = None
		min_move_cost = float('inf')
		for (mx, my, s) in move:
			cost = abs(nx + mx * d - X) + abs(ny + my * d - Y)
			if cost < min_move_cost:
				tmp_move_ans = s
				min_move_cost = cost
				tmp_move_x = mx
				tmp_move_y = my
		ans += tmp_move_ans
		(nx, ny) = (nx + tmp_move_x * d, ny + tmp_move_y * d)
	print(ans)


import sys
n = int(sys.stdin.readline().rstrip())
xy = list(zip(*[map(int, sys.stdin.read().split())] * 2))
mask = (1 << 31) - 1

def solve(x, y, mode):
	u = x + y
	v = x - y
	if mode == 0:
		u -= 1
		v -= 1
	s = u + mask >> 1
	t = v + mask >> 1
	l = ~(s | t) & mask
	r = s & t & mask
	d = ~s & t & mask
	u = s & ~t & mask
	res = ''
	for i in range(31):
		if l >> i & 1:
			res += 'L'
		elif r >> i & 1:
			res += 'R'
		elif d >> i & 1:
			res += 'D'
		elif u >> i & 1:
			res += 'U'
	if mode == 0:
		res += 'R'
	return [res]

def main():
	oe = (xy[0][0] + xy[0][1]) % 2
	for (x, y) in xy:
		if (x + y) % 2 != oe:
			print(-1)
			sys.exit()
	m = 31
	d = [2 ** i for i in range(31)]
	if oe == 0:
		d += [1]
		m += 1
	yield [m]
	yield d
	for (x, y) in xy:
		yield solve(x, y, oe)
ans = main()
for i in ans:
	print(*i, sep=' ')


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def func(X, Y, D):
	ans = ''
	(x, y) = (0, 0)
	for i in range(len(D)):
		d = D[i]
		best_j = 0
		best = INF
		for j in range(4):
			(nx, ny) = (x + dx4[j] * d - X, y + dy4[j] * d - Y)
			if abs(nx) + abs(ny) < best:
				best = abs(nx) + abs(ny)
				best_j = j
		(x, y) = (x + dx4[best_j] * d, y + dy4[best_j] * d)
		ans += 'RULD'[best_j]
	assert x == X and y == Y
	return ans

def main():
	N = int(input())
	points = []
	for i in range(N):
		(X, Y) = map(int, input().split())
		points.append((X, Y))
	for i in range(len(points) - 1):
		(x1, y1) = points[i]
		(x2, y2) = points[i + 1]
		if (x1 + y1) % 2 != (x2 + y2) % 2:
			print('-1')
			return
	D = [2 ** i for i in range(33)][::-1]
	if sum(points[0]) % 2 == 0:
		D.append(1)
	print(len(D))
	print(*D)
	for (x, y) in points:
		print(func(x, y, D))
main()


import sys

def input():
	return sys.stdin.readline().strip()

def direction_odd(x, y, m):
	ans = ''
	for i in range(m - 1, -1, -1):
		if y < x and y > -x:
			ans += 'R'
			x -= 2 ** i
		elif y > x and y > -x:
			ans += 'U'
			y -= 2 ** i
		elif y > x and y < -x:
			ans += 'L'
			x += 2 ** i
		elif y < x and y < -x:
			ans += 'D'
			y += 2 ** i
	return ans

def direction_even(x, y, m):
	if y <= x and y >= -x:
		last = 'R'
		x -= 1
	elif y >= x and y >= -x:
		last = 'U'
		y -= 1
	elif y >= x and y <= -x:
		last = 'L'
		x += 1
	elif y <= x and y <= -x:
		last = 'D'
		y += 1
	ans = direction_odd(x, y, m)
	return ans + last

def main():
	N = int(input())
	joint = []
	for _ in range(N):
		(x, y) = map(int, input().split())
		joint.append((x, y))
	even_odd = {0: 0, 1: 0}
	sum_max = 0
	for (x, y) in joint:
		even_odd[(x + y) % 2] += 1
		sum_max = max(sum_max, abs(x) + abs(y))
	if even_odd[0] > 0 and even_odd[1] > 0:
		print(-1)
		return
	m = 0
	while 2 ** m - 1 < sum_max:
		m += 1
	arms = [2 ** i for i in range(m - 1, -1, -1)]
	if even_odd[0] == 0:
		print(m)
		print(' '.join(map(str, arms)))
		for (x, y) in joint:
			print(direction_odd(x, y, m))
	if even_odd[0] != 0:
		print(m + 1)
		print(' '.join(map(str, arms)) + ' 1')
		for (x, y) in joint:
			print(direction_even(x, y, m))
main()


N = int(input())
XY = [[int(i) for i in input().split()] for _ in range(N)]
if len(set([(X + Y) % 2 for (X, Y) in XY])) != 1:
	print(-1)
else:
	d = []
	for i in range(32, -1, -1):
		d.append(1 << i)
	if (XY[0][0] + XY[0][1]) % 2 == 0:
		d.append(1)
	print(len(d))
	print(*d)
	for (X, Y) in XY:
		ret = ''
		(cx, cy) = (0, 0)
		for i in range(len(d)):
			(mj, mv) = (0, float('inf'))
			diff = [(d[i], 0), (-d[i], 0), (0, d[i]), (0, -d[i])]
			for (j, (dx, dy)) in enumerate(diff):
				if (cx + dx - X) ** 2 + (cy + dy - Y) ** 2 < mv:
					mj = j
					mv = (cx + dx - X) ** 2 + (cy + dy - Y) ** 2
			if mj == 0:
				ret += 'R'
				cx += d[i]
			elif mj == 1:
				ret += 'L'
				cx -= d[i]
			elif mj == 2:
				ret += 'U'
				cy += d[i]
			else:
				ret += 'D'
				cy -= d[i]
		print(ret)


N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
uv = [[XY[i][0] + XY[i][1], XY[i][0] - XY[i][1]] for i in range(N)]
mod = [uv[i][0] % 2 for i in range(N)]
if sum(mod) == N:
	print(40)
	print(*[2 ** i for i in range(40)])
	for i in range(N):
		(u, v) = uv[i]
		u += 2 ** 40 - 1
		u //= 2
		v += 2 ** 40 - 1
		v //= 2
		u = '{:040b}'.format(u)[::-1]
		v = '{:040b}'.format(v)[::-1]
		w = [0] * 40
		for j in range(40):
			if (u[j], v[j]) == ('1', '1'):
				w[j] = 'R'
			if (u[j], v[j]) == ('0', '0'):
				w[j] = 'L'
			if (u[j], v[j]) == ('1', '0'):
				w[j] = 'U'
			if (u[j], v[j]) == ('0', '1'):
				w[j] = 'D'
		print(''.join(w))
elif sum(mod) == 0:
	print(40)
	print(*[1] + [2 ** i for i in range(39)])
	for i in range(N):
		(u, v) = uv[i]
		u += 2 ** 39
		u //= 2
		v += 2 ** 39
		v //= 2
		u = '{:039b}'.format(u)[::-1]
		v = '{:039b}'.format(v)[::-1]
		w = [0] * 39
		for j in range(39):
			if (u[j], v[j]) == ('1', '1'):
				w[j] = 'R'
			if (u[j], v[j]) == ('0', '0'):
				w[j] = 'L'
			if (u[j], v[j]) == ('1', '0'):
				w[j] = 'U'
			if (u[j], v[j]) == ('0', '1'):
				w[j] = 'D'
		w = ['L'] + w
		print(''.join(w))
else:
	print(-1)


def main():
	N = int(input())
	P = []
	distance_max = 0
	mode = 0
	for i in range(N):
		(X, Y) = map(int, input().split())
		distance = abs(X) + abs(Y)
		if i == 0:
			mode = distance % 2
		elif distance % 2 != mode:
			print(-1)
			return
		if mode == 0:
			X = X - 1
			distance = abs(X) + abs(Y)
		if distance > distance_max:
			distance_max = distance
		P.append((X, Y))
	d = []
	di = 1
	for i in range(40):
		if di > distance_max:
			break
		d.append(di)
		di = di * 2
	d.sort(reverse=True)
	if mode == 0:
		d.append(1)
	print(len(d))
	print(' '.join(map(str, d)))
	for p in P:
		path = ''
		(x, y) = (p[0], p[1])
		previous = 0
		for di in d:
			if previous == di and di == 1:
				path = path + 'R'
				break
			if x + y < 0:
				if x - y < 0:
					path = path + 'L'
					x = x + di
				else:
					path = path + 'D'
					y = y + di
			elif x - y < 0:
				path = path + 'U'
				y = y - di
			else:
				path = path + 'R'
				x = x - di
			previous = di
		print(path)
	return
main()


n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
mod = sum(XY[0]) % 2
for (x, y) in XY:
	if mod != (x + y) % 2:
		print(-1)
		return
m = 33 - mod
print(m)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in XY:
	w = ' '
	for d in D:
		if x - y >= 0 and x + y >= 0:
			w += 'R'
			x -= d
		elif x - y < 0 and x + y >= 0:
			w += 'U'
			y -= d
		elif x - y >= 0 and x + y < 0:
			w += 'D'
			y += d
		else:
			w += 'L'
			x += d
	print(w)


n = int(input())
place = [tuple(map(int, input().split())) for _ in range(n)]
m = 0

def bitlist(x):
	ret = [0] * 31
	for i in reversed(range(31)):
		if x > 0:
			x -= 1 << i
			ret[i] = 1
		else:
			x += 1 << i
			ret[i] = -1
	return ret
pre = (place[0][0] + place[0][1] + 1) % 2
for (x, y) in place:
	if (x + y + 1) % 2 != pre:
		print(-1)
		exit()
print(31 + pre)
if pre:
	print(1, end=' ')
for i in reversed(range(31)):
	print(1 << i, end=' ')
print()
for (x, y) in place:
	u = x + y
	v = x - y
	if pre:
		u -= 1
		v -= 1
	ubit = bitlist(u)
	vbit = bitlist(v)
	if pre:
		print('R', end='')
	for i in reversed(range(31)):
		if ubit[i] == 1 and vbit[i] == 1:
			print('R', end='')
		elif ubit[i] == 1 and vbit[i] == -1:
			print('U', end='')
		elif ubit[i] == -1 and vbit[i] == -1:
			print('L', end='')
		else:
			print('D', end='')
	print()


N = int(input())
Pi = []
for i in range(N):
	d = list(map(int, input().split()))
	Pi.append(d)
for p in Pi[1:]:
	if (p[0] + p[1]) % 2 != (Pi[0][0] + Pi[0][1]) % 2:
		print(-1)
		return
Ai = []
if (Pi[0][0] + Pi[0][1]) % 2 == 0:
	Ai.append(1)
for i in range(0, 32):
	Ai.append(2 ** i)

def find_arm_pattern(arms, target_x, target_y):
	result = ''
	x = 0
	y = 0
	for a in arms:
		dx = target_x - x
		dy = target_y - y
		if abs(dx) >= abs(dy):
			if dx > 0:
				result += 'R'
				x += a
			else:
				result += 'L'
				x -= a
		elif dy > 0:
			result += 'U'
			y += a
		else:
			result += 'D'
			y -= a
	if x == target_x and y == target_y:
		return result
	return None
arms = list(reversed(Ai))
results = []
for p in Pi:
	r = find_arm_pattern(arms, p[0], p[1])
	results.append(r)
txt = str(arms)
print(len(arms))
print(txt[1:-1].replace(',', ''))
for r in results:
	print(r)


import sys

def f(s, t):
	if s >= t and -s <= t:
		return 0
	elif s <= t and -s <= t:
		return 1
	elif s <= t and -s >= t:
		return 2
	else:
		return 3
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
for i in range(1, n):
	if sum(xy[i]) % 2 != sum(xy[i - 1]) % 2:
		print(-1)
		sys.exit()
data_1 = ['R', 'U', 'L', 'D']
data_2 = [[1, 0], [0, 1], [-1, 0], [0, -1]]
arms = [2 ** i for i in range(32)]
if sum(xy[0]) % 2 == 1:
	print(len(arms))
	print(*arms)
	for (X, Y) in xy:
		(x, y) = (X, Y)
		ans = []
		i = 31
		while i >= 0:
			c = f(x, y)
			ans.append(data_1[c])
			x -= arms[i] * data_2[c][0]
			y -= arms[i] * data_2[c][1]
			i -= 1
		print(''.join(ans[::-1]))
else:
	arms = [1] + arms
	print(len(arms))
	print(*arms)
	for (X, Y) in xy:
		(x, y) = (X, Y)
		ans = []
		i = 32
		while i >= 1:
			c = f(x, y)
			ans.append(data_1[c])
			x -= arms[i] * data_2[c][0]
			y -= arms[i] * data_2[c][1]
			i -= 1
		if x == 1:
			ans.append('R')
		elif x == -1:
			ans.append('L')
		elif y == 1:
			ans.append('U')
		else:
			ans.append('D')
		print(''.join(ans[::-1]))


N = int(input())
XY = [list(map(int, input().split(' '))) for _ in range(N)]
parity = (XY[0][0] + XY[0][1]) % 2
maxXY = 0
for (x, y) in XY:
	if (x + y) % 2 != parity:
		print('-1')
		return
	maxXY = max(x + y, maxXY)
arm = [1, 1]
if parity == 1:
	arm[1] = 2
tmp = arm[1]
m = 2
for _ in range(40):
	tmp *= 2
	m += 1
	arm.append(tmp)
	if tmp > maxXY:
		break
print(m)
print(' '.join(map(str, arm)))
armR = arm[::-1]
for (x, y) in XY:
	(nowX, nowY) = [x, y]
	ansR = ''
	for l in armR:
		if abs(nowX) >= abs(nowY):
			if nowX >= 0:
				nowX -= l
				ansR += 'R'
			else:
				nowX += l
				ansR += 'L'
		elif nowY >= 0:
			nowY -= l
			ansR += 'U'
		else:
			nowY += l
			ansR += 'D'
	print(ansR[::-1])


import sys
input = sys.stdin.readline
n = int(input())
xy = []
for _ in range(n):
	xy.append(list(map(int, input().split())))
m = 1
parity = sum(xy[0]) % 2
far = 0
for point in xy:
	length = sum(list(map(abs, point)))
	if length > far:
		far = length
	if length % 2 != parity:
		m = -1
if m == -1:
	print(m)
else:
	if parity == 0:
		ds = [1, 1]
	else:
		ds = [1, 1, 1]
	i = 1
	while 2 ** i < far:
		ds.append(2 ** i)
		i += 1
	ds.append(2 ** i)
	ds.reverse()
	print(len(ds))
	print(*ds, sep=' ')
	for point in xy:
		direction = ''
		point0 = [0, 0]
		for arm in ds:
			x = point[0] - point0[0]
			y = point[1] - point0[1]
			if abs(x) > abs(y):
				if x > 0:
					direction += 'R'
					point0[0] += arm
				else:
					direction += 'L'
					point0[0] -= arm
			elif y > 0:
				direction += 'U'
				point0[1] += arm
			else:
				direction += 'D'
				point0[1] -= arm
		print(direction)


N = int(input())
XY = [tuple(map(int, input().split())) for i in range(N)]
guuki = (XY[0][0] + XY[0][1]) % 2
for (x, y) in XY:
	if (x + y) % 2 != guuki:
		print(-1)
		exit()
arms = []
n = 1
for i in range(39):
	arms.append(n)
	n *= 2
if guuki == 0:
	arms.append(1)
arms.reverse()
dirs = {'R': (1, 0), 'U': (0, 1), 'L': (-1, 0), 'D': (0, -1)}
print(len(arms))
print(*arms)
for (x, y) in XY:
	nx = ny = 0
	s = ''
	if guuki == 0:
		nx += 1
		s += 'R'
	for a in arms[-39:]:
		dist = float('inf')
		dr = ''
		for (d, (dx, dy)) in dirs.items():
			tmp = abs(x - (nx + dx * a)) + abs(y - (ny + dy * a))
			if tmp < dist:
				dist = tmp
				dr = d
		(dx, dy) = dirs[dr]
		nx += dx * a
		ny += dy * a
		s += dr
	print(s)


def solve(N, XY):
	tmp = 0
	for (x, y) in XY:
		tmp += (abs(x) + abs(y)) % 2
	if tmp % N != 0:
		print(-1)
		return
	import math
	m = math.ceil(math.log2(2 * 10 ** 9)) + 1
	d = [2 ** (m - i) for i in range(m)] + [1]
	d += [1] if tmp == 0 else []
	m = len(d)
	w = []
	for (xi, yi) in XY:
		xx = 0
		yy = 0
		W = ''
		for di in d:
			if abs(xi - xx) >= abs(yi - yy):
				if xx <= xi:
					xx += di
					W += 'R'
				else:
					xx -= di
					W += 'L'
			elif yy <= yi:
				yy += di
				W += 'U'
			else:
				yy -= di
				W += 'D'
		w.append(W)
	print(m)
	print(' '.join([str(i) for i in d]))
	[print(wi) for wi in w]

def __starting_point():
	N = int(input())
	XY = [[int(i) for i in input().split()] for _ in range(N)]
	solve(N, XY)
__starting_point()


def d_robot_arms(N, Pos):
	ans = []
	pos = []
	parity = (abs(Pos[0][0]) + abs(Pos[0][1])) % 2
	for (x, y) in Pos:
		parity_current = (abs(x) + abs(y)) % 2
		if parity != parity_current:
			return -1
		pos.append([x - y, x + y])
	d = []
	for i in range(30, -1, -1):
		d.append(1 << i)
	if parity % 2 == 0:
		d.append(1)
	ans.append(str(len(d)))
	ans.append(' '.join(list(map(str, d))))
	for i in range(N):
		(udir, vdir) = (0, 0)
		(usum, vsum) = (0, 0)
		tmp = []
		for j in range(len(d)):
			if usum <= pos[i][0]:
				udir = 1
				usum += d[j]
			else:
				udir = -1
				usum -= d[j]
			if vsum <= pos[i][1]:
				vdir = 1
				vsum += d[j]
			else:
				vdir = -1
				vsum -= d[j]
			if udir == 1 and vdir == 1:
				tmp.append('R')
			elif udir == 1 and vdir == -1:
				tmp.append('D')
			elif udir == -1 and vdir == -1:
				tmp.append('L')
			else:
				tmp.append('U')
		ans.append(''.join(tmp))
	ans = '\n'.join(ans)
	return ans
N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(d_robot_arms(N, Pos))


import copy
N = int(input())
X = []
X.append(list(map(int, input().split())))
T = (X[0][0] + X[0][1]) % 2
max = abs(X[0][0]) + abs(X[0][1])
for i in range(1, N):
	X.append(list(map(int, input().split())))
	t = abs(X[i][0]) + abs(X[i][1])
	if t % 2 != T:
		print(-1)
		return
	if max < t:
		max = t
D = []
sum = 0
if T == 0:
	max -= 1
t = 1
while 1:
	D.append(t)
	sum += t
	if sum >= max:
		break
	t *= 2
if T == 0:
	D.append(1)
D.reverse()
print(len(D))
s = ''
for i in range(len(D)):
	s += str(D[i]) + ' '
print(s)
for i in range(N):
	U = X[i][0] + X[i][1]
	V = X[i][0] - X[i][1]
	s = ''
	for j in range(len(D)):
		if U >= 0:
			if V >= 0:
				s += 'R'
				U -= D[j]
				V -= D[j]
			else:
				s += 'U'
				U -= D[j]
				V += D[j]
		elif V >= 0:
			s += 'D'
			U += D[j]
			V -= D[j]
		else:
			s += 'L'
			U += D[j]
			V += D[j]
	print(s)


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
s = set([(x + y) % 2 for (x, y) in xy])
if len(s) > 1:
	print(-1)
	exit(0)
d = []
w = ['' for _ in xy]
if s.pop() == 0:
	d = [1]
	w = ['L' for _ in xy]
	xy = [(x + 1, y) for (x, y) in xy]
b = 1
while True:
	if all((abs(x) + abs(y) == 1 for (x, y) in xy)):
		d.append(b)
		for i in range(len(xy)):
			(x, y) = xy[i]
			if x > 0:
				w[i] += 'R'
			elif x < 0:
				w[i] += 'L'
			elif y > 0:
				w[i] += 'U'
			else:
				w[i] += 'D'
		break
	d.append(b)
	for i in range(len(xy)):
		(x, y) = xy[i]
		if x % 2 == 1:
			if y % 4 == 2 and (x - 1) % 4 == 0 or (y % 4 == 0 and (x - 1) % 4 == 2):
				w[i] += 'R'
				xy[i] = ((x - 1) // 2, y // 2)
			else:
				w[i] += 'L'
				xy[i] = ((x + 1) // 2, y // 2)
		elif x % 4 == 2 and (y - 1) % 4 == 0 or (x % 4 == 0 and (y - 1) % 4 == 2):
			w[i] += 'U'
			xy[i] = (x // 2, (y - 1) // 2)
		else:
			w[i] += 'D'
			xy[i] = (x // 2, (y + 1) // 2)
	b *= 2
print(len(d))
print(*d)
for t in w:
	print(t)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
n = int(input())
(X, Y) = ([], [])
for _ in range(n):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
mod = (X[0] + Y[0]) % 2
for i in range(1, n):
	if (X[i] + Y[i]) % 2 != mod:
		print(-1)
		exit()
if not mod:
	X = [x + 1 for x in X]
U = [X[i] + Y[i] for i in range(n)]
V = [X[i] - Y[i] for i in range(n)]
Mode = ['L', 'D', 'U', 'R']
m = 31
if mod:
	print(m)
	print(' '.join([str(2 ** i) for i in range(m)]))
else:
	print(m + 1)
	print('1 ' + ' '.join([str(2 ** i) for i in range(m)]))
for i in range(n):
	w = ''
	if not mod:
		w = 'L'
	ui = (U[i] + 2 ** m - 1) // 2
	vi = (V[i] + 2 ** m - 1) // 2
	for _ in range(m):
		(u_bit, v_bit) = (ui & 1, vi & 1)
		ui >>= 1
		vi >>= 1
		w += Mode[u_bit * 2 + v_bit]
	print(w)


import sys
sys.setrecursionlimit(2147483647)
INF = float('inf')
MOD = 10 ** 9 + 7
input = lambda : sys.stdin.readline().rstrip()

def resolve():
	n = int(input())
	XY = [tuple(map(int, input().split())) for _ in range(n)]
	parity = [0] * 2
	for (x, y) in XY:
		parity[(x + y) % 2] = 1
	if parity[0] and parity[1]:
		print(-1)
		return
	m = 31
	D = [pow(2, i) for i in range(m)]
	if parity[0]:
		XY = [(x - 1, y) for (x, y) in XY]
		D = [1] + D
	U = [x - y for (x, y) in XY]
	V = [x + y for (x, y) in XY]
	W = [0] * n
	for j in range(n):
		res = [0] * m
		u = (U[j] + pow(2, m) - 1) // 2
		v = (V[j] + pow(2, m) - 1) // 2
		for i in range(m):
			ub = u & 1
			vb = v & 1
			if ub and vb:
				res[i] = 'R'
			elif ub and (not vb):
				res[i] = 'D'
			elif not ub and vb:
				res[i] = 'U'
			else:
				res[i] = 'L'
			u >>= 1
			v >>= 1
		ans = ''.join(res)
		W[j] = ans
	m = m + parity[0]
	print(m)
	print(*D)
	for j in range(n):
		ans = W[j] if parity[1] else 'R' + W[j]
		print(ans)
resolve()


inf = float('inf')
n = int(input())
coordinates = [tuple(map(int, input().split())) for _ in range(n)]
parity = None
can_make = True
for coordinate in coordinates:
	if parity is None:
		parity = sum(coordinate) % 2
	elif parity != sum(coordinate) % 2:
		can_make = False
		break
if not can_make:
	print(-1)
	return
m = 40
if parity == 0:
	d = [pow(2, i) for i in range(39)] + [1]
else:
	d = [pow(2, i) for i in range(40)]
d.sort(reverse=True)
ans = []
for (x, y) in coordinates:
	(curx, cury) = (0, 0)
	ops = ''
	for dd in d:
		dist = inf
		op = ''
		(det_dx, det_dy) = (0, 0)
		for (c, (dx, dy)) in zip('LRDU', [(-1, 0), (1, 0), (0, -1), (0, 1)]):
			t = abs(curx + dx * dd - x) + abs(cury + dy * dd - y)
			if dist > t:
				op = c
				dist = t
				det_dx = dx
				det_dy = dy
		ops += op
		curx += det_dx * dd
		cury += det_dy * dd
	if (curx, cury) == (x, y):
		ans.append(ops)
	else:
		print(-1)
print(m)
print(*d)
print(*ans, sep='\n')


from math import *

def L(xi, di):
	return xi - di

def R(xi, di):
	return xi + di

def D(yi, di):
	return yi - di

def U(yi, di):
	return yi + di

def main():
	N = int(input())
	x_list = [list(map(int, input().split())) for i in range(N)]
	sum_list = [x[0] + x[1] for x in x_list]
	checker = sum_list[0] % 2
	for wa in sum_list:
		if wa % 2 != checker:
			print('-1')
			return
	arm_list = []
	if checker == 0:
		arm_list.append(1)
	pow_i = 0
	max_sum = max(sum_list)
	while max_sum > sum(arm_list):
		arm_list.insert(0, 2 ** pow_i)
		pow_i += 1
	print(len(arm_list))
	print(' '.join(map(str, arm_list)))
	for c in x_list:
		now_c = [0, 0]
		order = ''
		for arm in arm_list:
			dx = c[0] - now_c[0]
			dy = c[1] - now_c[1]
			if abs(dx) > abs(dy):
				if dx > 0:
					order += 'R'
					now_c[0] = R(now_c[0], arm)
				else:
					order += 'L'
					now_c[0] = L(now_c[0], arm)
			elif dy > 0:
				order += 'U'
				now_c[1] = U(now_c[1], arm)
			else:
				order += 'D'
				now_c[1] = D(now_c[1], arm)
		print(order)
main()


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def parity():
	res = sum(xy[0]) % 2
	for (x, y) in xy:
		if (x + y) % 2 != res:
			return -1
	return res
n = II()
xy = LLI(n)
p = parity()
if p == -1:
	print(-1)
	exit()
dd = [1]
if p == 0:
	dd.append(1)
lim = 10 ** 12
while len(dd) < 40 and dd[-1] * 2 <= lim:
	dd.append(dd[-1] * 2)
print(40)
print(*dd)
for (x, y) in xy:
	ans = ''
	for d in dd[::-1]:
		if abs(x) > abs(y):
			if x > 0:
				x -= d
				ans += 'R'
			else:
				x += d
				ans += 'L'
		elif y > 0:
			y -= d
			ans += 'U'
		else:
			y += d
			ans += 'D'
	print(ans[::-1])


from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	return list(sys.stdin.readline())[:-1]

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def A():
	n = S()
	for i in n:
		if i == '1':
			print(9, end='')
		else:
			print(1, end='')
	print()

def B():
	n = I()
	for i in range(n, 1000):
		if i % 111 == 0:
			print(i)
			quit()
	return

def C():
	return

def D():
	n = I()
	p = LIR(n)
	b = []
	for i in range(n):
		(x, y) = p[i]
		for j in range(i):
			(s, t) = p[j]
			if (abs(x - s) + abs(y - t)) % 2:
				print(-1)
				return
	ans = []
	for i in range(n):
		f = 0
		(x, y) = p[i]
		if not (x + y) % 2:
			x -= 1
			if not ans:
				ans.append(1)
		if x < 0:
			x = -x
			f |= 1
		if y < 0:
			y = -y
			f |= 2
		bx = list(map(int, bin(x)[2:]))
		by = list(map(int, bin(y)[2:]))
		bx = bx[::-1]
		by = by[::-1]
		for _ in range(39 - len(bx)):
			bx.append(0)
		for _ in range(39 - len(by)):
			by.append(0)
		b.append([bx, by, f])
	for i in range(39):
		ans.append(1 << i)
	v = [[] for i in range(n)]
	for i in range(n):
		(x, y, f) = b[i]
		if x[0]:
			p = 1
			v[i].append(0)
		else:
			p = 0
			v[i].append(1)
		for j in range(1, 39):
			if p:
				if x[j]:
					if y[j]:
						v[i][-1] ^= 3
						k = j + 1
						while x[k]:
							x[k] ^= 1
							k += 1
						x[k] = 1
						v[i].append(1)
						p = 0
					else:
						v[i].append(0)
				elif y[j]:
					v[i].append(1)
					p = 0
				else:
					v[i][-1] ^= 3
					v[i].append(0)
			elif y[j]:
				if x[j]:
					v[i][-1] ^= 3
					k = j + 1
					while y[k]:
						y[k] ^= 1
						k += 1
					y[k] = 1
					v[i].append(0)
					p = 1
				else:
					v[i].append(1)
			elif x[j]:
				v[i].append(0)
				p = 1
			else:
				v[i][-1] ^= 3
				v[i].append(1)
		for j in range(39):
			if v[i][j] in [0, 3]:
				if f & 1:
					v[i][j] ^= 3
			elif f & 2:
				v[i][j] ^= 3
	p = ['R', 'U', 'D', 'L']
	print(len(ans))
	print(*ans)
	for i in v:
		if len(ans) == 40:
			print('R', end='')
		for j in i:
			print(p[j], end='')
		print()
	return

def E():
	return

def F():
	return

def G():
	return

def H():
	return
D()


import sys
input = sys.stdin.readline
INF = float('inf')

def inpl():
	return list(map(int, input().split()))

def move_uv(x, y):
	ut = x + y
	vt = x - y
	command = ''
	(u, v) = (0, 0)
	for i in range(len(D)):
		if u <= ut and v <= vt:
			command += 'R'
			u += D[i]
			v += D[i]
		elif u <= ut and v > vt:
			command += 'U'
			u += D[i]
			v -= D[i]
		elif u > ut and v <= vt:
			command += 'D'
			u -= D[i]
			v += D[i]
		else:
			command += 'L'
			u -= D[i]
			v -= D[i]
	return command
N = int(input())
point = []
max_length = 0
for i in range(N):
	(x, y) = inpl()
	max_length = max(max_length, abs(x) + abs(y))
	point.append([x, y])
parity = sum(point[0]) % 2
judge = True
for p in point:
	if parity ^ sum(p) % 2:
		judge = False
		break
if not judge:
	print(-1)
else:
	D = [2 ** i for i in range(len(bin(max_length)) - 1)]
	D.reverse()
	if parity == 0:
		D.append(1)
	print(len(D))
	print(' '.join(map(str, D)))
	for i in range(N):
		print(move_uv(point[i][0], point[i][1]))


n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
s = set([(x + y) % 2 for (x, y) in xy])
if len(s) > 1:
	print(-1)
	exit(0)
d = []
w = ['' for _ in xy]
if s.pop() == 0:
	d = [1]
	w = ['L' for _ in xy]
	xy = [(x + 1, y) for (x, y) in xy]
b = 1 << 30
while b > 0:
	d.append(b)
	for i in range(len(xy)):
		(x, y) = xy[i]
		if abs(x) > abs(y):
			if x > 0:
				w[i] += 'R'
				xy[i] = (x - b, y)
			else:
				w[i] += 'L'
				xy[i] = (x + b, y)
		elif y > 0:
			w[i] += 'U'
			xy[i] = (x, y - b)
		else:
			w[i] += 'D'
			xy[i] = (x, y + b)
	b //= 2
print(len(d))
print(*d)
for t in w:
	print(t)


n = int(input())
xy = [[int(item) for item in input().split()] for _ in range(n)]
mod2 = (xy[0][0] + xy[0][1]) % 2
for (x, y) in xy:
	if (x + y) % 2 != mod2:
		print(-1)
		exit()
if mod2 == 1:
	print(31)
	print(' '.join([str(2 ** item) for item in range(31)]))
else:
	print(32)
	print('1 ' + ' '.join([str(2 ** item) for item in range(31)]))
for (x, y) in xy:
	if mod2 == 0:
		x -= 1
		print('R', end='')
	u = x + y
	v = x - y
	bits = [[0] * 31 for _ in range(2)]
	if u < 0:
		bits[0] = [1] * 31
		bits[0][30] = 0
	else:
		bits[0][30] = 1
	if v < 0:
		bits[1] = [1] * 31
		bits[1][30] = 0
	else:
		bits[1][30] = 1
	for i in range(30):
		if u >= 0 and abs(u) // 2 >> i & 1:
			bits[0][i] = 1
		if u < 0 and abs(u) // 2 >> i & 1:
			bits[0][i] = 0
		if v >= 0 and abs(v) // 2 >> i & 1:
			bits[1][i] = 1
		if v < 0 and abs(v) // 2 >> i & 1:
			bits[1][i] = 0
	for (u_b, v_b) in zip(bits[0], bits[1]):
		if u_b == 1 and v_b == 1:
			print('R', end='')
		elif u_b == 0 and v_b == 0:
			print('L', end='')
		elif u_b == 1 and v_b == 0:
			print('U', end='')
		elif u_b == 0 and v_b == 1:
			print('D', end='')
	print('')


def main():
	N = int(input())
	XY_list = []
	for i in range(N):
		XY_list.append(list(map(int, input().split())))
	rot_list = list(map(lambda xy: [xy[0] + xy[1], -xy[0] + xy[1]], XY_list))
	f = True
	p = rot_list[0][0] % 2
	for i in range(1, N):
		if rot_list[i][0] % 2 != p:
			f = False
			break
	if not f:
		print(-1)
	else:
		offset = 2 ** 31 - p
		m = 32 - p
		d = []
		if p == 0:
			d.append(1)
		for k in range(31):
			d.append(2 ** k)
		w = []
		for i in range(N):
			uv = rot_list[i]
			(u, v) = (uv[0] + offset, uv[1] + offset)
			s = ''
			if p == 0:
				s = 'D'
			for k in range(31):
				u //= 2
				v //= 2
				(u1, v1) = (u % 2, v % 2)
				if u1 == 0 and v1 == 0:
					s += 'D'
				elif u1 == 0 and v1 == 1:
					s += 'L'
				elif u1 == 1 and v1 == 0:
					s += 'R'
				elif u1 == 1 and v1 == 1:
					s += 'U'
			w.append(s)
		print(m)
		s = ''
		for dv in d:
			s += ' ' + str(dv)
		print(s[1:])
		for i in range(N):
			print(w[i])
main()


import sys, math, collections, heapq, itertools

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b > 0:
		(a, b) = (b, a % b)
	return b

def solve():
	file = sys.stdin.readline
	N = int(file())
	point = [[int(i) for i in file().split()] for j in range(N)]
	length = (point[0][0] + point[0][1]) % 2
	for i in range(1, N):
		if sum(point[i]) % 2 != length:
			print(-1)
			break
	else:
		d = [pow(2, i) for i in range(31)]
		direction = {('0', '0'): 'L', ('1', '1'): 'R', ('0', '1'): 'D', ('1', '0'): 'U'}
		ans = ''
		add = 0 if length == 1 else 1
		if add == 1:
			d.append(1)
		for i in range(N):
			(U, V) = (point[i][0] + point[i][1] + add, point[i][0] - point[i][1] + add)
			ubit = format((U + pow(2, 31) - 1) // 2, 'b').zfill(31)
			vbit = format((V + pow(2, 31) - 1) // 2, 'b').zfill(31)
			arm = ''
			for j in reversed(range(31)):
				arm += direction[ubit[j], vbit[j]]
			if add == 1:
				arm += 'L'
			ans += arm + '\n'
		print(len(d))
		print(' '.join(map(str, d)))
		print(ans)
	INF = 10 ** 25
	mod = 7 + 10 ** 9
	return 0

def __starting_point():
	solve()
__starting_point()


def solve():
	D = list(map(2 .__pow__, range(31)[::-1]))
	wdict = {(True, True): ('R', -1, -1), (True, False): ('U', -1, 1), (False, False): ('L', 1, 1), (False, True): ('D', 1, -1)}
	mode = None
	for _ in [None] * int(input()):
		(x, y) = map(int, input().split())
		u = x + y
		if mode is None:
			mode = 1 - u % 2
			res = str(31 + mode) + '\n' + ' '.join(map(str, [1] * mode + D))
			W0 = '\n' + 'R' * mode
		elif mode != 1 - u % 2:
			return '-1'
		res += W0
		u -= mode
		v = x - y - mode
		for d in D:
			(w, a, b) = wdict[u > 0, v > 0]
			res += w
			u += a * d
			v += b * d
	return str(res)
print(solve())


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
	input_tuple = input().split()
	if len(input_tuple) <= 1:
		return int(input_tuple[0])
	return tuple(map(int, input_tuple))

def intina():
	return [int(i) for i in input().split()]

def intinl(count):
	return [intin() for _ in range(count)]

def modadd(x, y):
	nonlocal mod
	return (x + y) % mod

def modmlt(x, y):
	nonlocal mod
	return x * y % mod

def lcm(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x

def get_divisors(x):
	retlist = []
	for i in range(1, int(x ** 0.5) + 3):
		if x % i == 0:
			retlist.append(i)
			retlist.append(x // i)
	return retlist

def make_linklist(xylist):
	linklist = {}
	for (a, b) in xylist:
		linklist.setdefault(a, [])
		linklist.setdefault(b, [])
		linklist[a].append(b)
		linklist[b].append(a)
	return linklist

def calc_longest_distance(linklist, v=1):
	distance_list = {}
	distance_count = 0
	distance = 0
	vlist_previous = []
	vlist = [v]
	nodecount = len(linklist)
	while distance_count < nodecount:
		vlist_next = []
		for v in vlist:
			distance_list[v] = distance
			distance_count += 1
			vlist_next.extend(linklist[v])
		distance += 1
		vlist_to_del = vlist_previous
		vlist_previous = vlist
		vlist = list(set(vlist_next) - set(vlist_to_del))
	max_distance = -1
	max_v = None
	for (v, distance) in list(distance_list.items()):
		if distance > max_distance:
			max_distance = distance
			max_v = v
	return (max_distance, max_v)

def calc_tree_diameter(linklist, v=1):
	(_, u) = calc_longest_distance(linklist, v)
	(distance, _) = calc_longest_distance(linklist, u)
	return distance

def main():
	n = intin()
	xylist = intinl(n)
	even_odd = None
	uvlist = []
	for (x, y) in xylist:
		tmp_even_odd = (x + y) % 2
		if even_odd is None:
			even_odd = tmp_even_odd
		if even_odd != tmp_even_odd:
			print(-1)
			return
		uvlist.append((x + y, x - y))
	m = 33 if even_odd else 34
	print(m)
	dlist = [str(2 ** i) for i in reversed(list(range(0, 33)))]
	if not even_odd:
		dlist.append('1')
	print(' '.join(dlist))
	for (u, v) in uvlist:
		if not even_odd:
			u += 1
			v += 1
		line = ''
		if u >= 0 and v >= 0:
			line += 'R'
		if u >= 0 and v < 0:
			line += 'U'
		if u < 0 and v >= 0:
			line += 'D'
		if u < 0 and v < 0:
			line += 'L'
		for i in reversed(list(range(1, 33))):
			u_bit = u >> i & 1
			v_bit = v >> i & 1
			if u_bit and v_bit:
				line += 'R'
			if u_bit and (not v_bit):
				line += 'U'
			if not u_bit and v_bit:
				line += 'D'
			if not u_bit and (not v_bit):
				line += 'L'
		if not even_odd:
			line += 'L'
		print(line)

def __starting_point():
	main()
__starting_point()


(N, *XY) = map(int, open(0).read().split())
XY = list(zip(*[iter(XY)] * 2))
mod = sum(XY[0]) % 2
if any(((x + y) % 2 != mod for (x, y) in XY)):
	print(-1)
	return
D = [2 ** i for i in reversed(range(32))] + [1] * (mod == 0)
print(len(D))
print(*D)
for (x, y) in XY:
	A = []
	for d in D:
		if 0 <= x - y and 0 <= x + y:
			A.append('R')
			x -= d
		elif x - y < 0 and 0 <= x + y:
			A.append('U')
			y -= d
		elif 0 <= x - y and x + y < 0:
			A.append('D')
			y += d
		else:
			A.append('L')
			x += d
	print(''.join(A))


N = int(input())
XY = []
parity = []
for _ in range(N):
	xy = list(map(int, input().split()))
	XY.append(xy)
	parity.append(sum(xy))

def check(ds, l, xy):
	x = 0
	y = 0
	for i in range(len(ds)):
		if l[i] == 'R':
			x += ds[i]
		elif l[i] == 'L':
			x -= ds[i]
		elif l[i] == 'U':
			y += ds[i]
		elif l[i] == 'D':
			y -= ds[i]
		else:
			raise Exception
	return (x == xy[0]) & (y == xy[1])
if len(list(set([i % 2 for i in parity]))) == 2:
	print(-1)
elif parity[0] % 2 == 0:
	print(33)
	ds = [1, 1] + [2 ** k for k in range(1, 32)]
	print(*ds)
	for xy in XY:
		rev_ans = ''
		(curr_x, curr_y) = (0, 0)
		for d in ds[::-1]:
			x_diff = xy[0] - curr_x
			y_diff = xy[1] - curr_y
			if abs(x_diff) >= abs(y_diff):
				if x_diff >= 0:
					rev_ans += 'R'
					curr_x += d
				else:
					rev_ans += 'L'
					curr_x -= d
			elif y_diff >= 0:
				rev_ans += 'U'
				curr_y += d
			else:
				rev_ans += 'D'
				curr_y -= d
		print(rev_ans[::-1])
else:
	print(32)
	ds = [2 ** k for k in range(32)]
	print(*ds)
	for xy in XY:
		rev_ans = ''
		(curr_x, curr_y) = (0, 0)
		for d in ds[::-1]:
			x_diff = xy[0] - curr_x
			y_diff = xy[1] - curr_y
			if abs(x_diff) >= abs(y_diff):
				if x_diff >= 0:
					rev_ans += 'R'
					curr_x += d
				else:
					rev_ans += 'L'
					curr_x -= d
			elif y_diff >= 0:
				rev_ans += 'U'
				curr_y += d
			else:
				rev_ans += 'D'
				curr_y -= d
		print(rev_ans[::-1])


def d_robot_arms(N, Pos):
	pos = []
	parity = (abs(Pos[0][0]) + abs(Pos[0][1])) % 2
	for (x, y) in Pos:
		parity_current = (abs(x) + abs(y)) % 2
		if parity != parity_current:
			return -1
		pos.append([x - y, x + y])
	arms = [1 << k for k in range(30, -1, -1)]
	if parity % 2 == 0:
		arms.append(1)
	ans_tmp = [str(len(arms)), ' '.join(list(map(str, arms)))]
	for (pos_u, pos_v) in pos:
		(usum, vsum) = (0, 0)
		tmp = ''
		for arm_len in arms:
			if usum <= pos_u:
				udir = 'positive'
				usum += arm_len
			else:
				udir = 'negative'
				usum -= arm_len
			if vsum <= pos_v:
				vdir = 'positive'
				vsum += arm_len
			else:
				vdir = 'negative'
				vsum -= arm_len
			if udir == 'positive' and vdir == 'positive':
				tmp += 'R'
			elif udir == 'positive' and vdir == 'negative':
				tmp += 'D'
			elif udir == 'negative' and vdir == 'negative':
				tmp += 'L'
			else:
				tmp += 'U'
		ans_tmp.append(''.join(tmp))
	ans = '\n'.join(ans_tmp)
	return ans
N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(d_robot_arms(N, Pos))


import os
import sys
import numpy as np
if os.getenv('LOCAL'):
	sys.stdin = open('_in.txt', 'r')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
IINF = 10 ** 18
MOD = 10 ** 9 + 7
N = int(sys.stdin.buffer.readline())
XY = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(N)]
(x, y) = XY[0]
odd = (abs(x) + abs(y)) % 2
ok = True
for (x, y) in XY:
	ok &= (abs(x) + abs(y)) % 2 == odd
if not ok:
	print(-1)
	return

def solve(x):
	n = int((2 ** 39 - 1 + x) // 2)
	ret = []
	for _ in range(39):
		if n & 1:
			ret.append(1)
		else:
			ret.append(-1)
		n >>= 1
	ret = np.array(ret, dtype=int)
	return ret
P = [complex(x, y) for (x, y) in XY]
P = np.array(P)
if not odd:
	P -= 1
P *= 1 + 1j
D = (2 ** np.arange(39, dtype=int)).tolist()
ans = []
for p in P:
	xd = solve(p.real)
	yd = solve(p.imag)
	W = np.empty_like(D, dtype='U1')
	W[(xd > 0) & (yd > 0)] = 'R'
	W[(xd > 0) & (yd < 0)] = 'D'
	W[(xd < 0) & (yd > 0)] = 'U'
	W[(xd < 0) & (yd < 0)] = 'L'
	ans.append(''.join(W))
if not odd:
	D.append(1)
	for i in range(len(ans)):
		ans[i] += 'R'
print(len(D))
print(*D)
print(*ans, sep='\n')


import sys
try:
	from typing import List
except ImportError:
	pass

def solve(N: int, X: 'List[int]', Y: 'List[int]'):
	parities = {(Xi + Yi) % 2 for (Xi, Yi) in zip(X, Y)}
	if len(parities) > 1:
		print(-1)
		return
	d = [1 << i for i in range(39)]
	if next(iter(parities)) == 0:
		d.append(1)
	print(len(d))
	print(*d)
	x0 = -sum(d)
	for (Xi, Yi) in zip(X, Y):
		u = (Xi - x0 - Yi) // 2
		v = (Xi - x0 + Yi) // 2
		modes = []
		for i in range(39):
			ui = u & 1 << i != 0
			vi = v & 1 << i != 0
			modes.append({(False, False): 'L', (False, True): 'U', (True, False): 'D', (True, True): 'R'}[ui, vi])
		if len(d) > len(modes):
			modes.append('L')
		print(''.join(modes))

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	X = [int()] * N
	Y = [int()] * N
	for i in range(N):
		X[i] = int(next(tokens))
		Y[i] = int(next(tokens))
	solve(N, X, Y)
main()


def main():
	N = int(input())
	(X, Y) = zip(*(map(int, input().split()) for _ in range(N)))
	(m, d, w) = ref(N, X, Y)
	if m == -1:
		print(-1)
	else:
		print(m)
		print(*d)
		print(*w, sep='\n')

def ex1(N, X, Y):
	m = 2
	d = [1, 2]
	w = ['RL', 'UU', 'DR']
	return (m, d, w)

def part_300(N, X, Y):
	dists = []
	for (x, y) in zip(X, Y):
		dist = abs(x) + abs(y)
		dists.append(dist)
	m = -1
	d = []
	w = []
	mod = list(map(lambda x: x % 2, dists))
	if len(set(mod)) == 1:
		m = max(dists)
		d = [1] * m
		for (x, y, dist) in zip(X, Y, dists):
			x_dir = 'R' if x > 0 else 'L'
			y_dir = 'U' if y > 0 else 'D'
			_w = x_dir * abs(x) + y_dir * abs(y)
			rest = m - len(_w)
			if rest > 0:
				_w += 'LR' * (rest // 2)
			w.append(_w)
	return (m, d, w)

def editorial(N, X, Y):
	pass

def ref(N, X, Y):
	dists = []
	for (x, y) in zip(X, Y):
		dist = (abs(x) + abs(y)) % 2
		dists.append(dist)
	m = -1
	d = []
	w = []
	mod = set(map(lambda x: x % 2, dists))
	if len(mod) != 1:
		return (m, d, w)
	for i in range(30, 0 - 1, -1):
		d.append(1 << i)
	if 0 in mod:
		d.append(1)
	m = len(d)
	w = no_transform_xy(N, X, Y, d)
	return (m, d, w)

def transform_xy(N, X, Y, d):
	w = []
	dirs = {(-1, -1): 'L', (+1, +1): 'R', (+1, -1): 'U', (-1, +1): 'D'}
	for (x, y) in zip(X, Y):
		x_sum = 0
		y_sum = 0
		_w = ''
		for _d in d:
			if x_sum <= x:
				x_dir = 1
				x_sum += _d
			else:
				x_dir = -1
				x_sum -= _d
			if y_sum <= y:
				y_dir = 1
				y_sum += _d
			else:
				y_dir = -1
				y_sum -= _d
			_w += dirs[x_dir, y_dir]
		w.append(_w)
	return w

def no_transform_xy(N, X, Y, d):
	w = []
	for (xt, yt) in zip(X, Y):
		(x, y) = (0, 0)
		_w = ''
		for _d in d:
			if abs(x - xt) >= abs(y - yt):
				if x >= xt:
					x -= _d
					_w += 'L'
				else:
					x += _d
					_w += 'R'
			elif y >= yt:
				y -= _d
				_w += 'D'
			else:
				y += _d
				_w += 'U'
		w.append(_w)
	return w
main()


def main():
	N = int(input())
	xy = []
	for _ in range(N):
		(x, y) = map(int, input().split())
		xy.append((x, y))
	mod = sum(xy[0]) % 2
	for (x, y) in xy:
		if (x + y) % 2 != mod:
			print(-1)
			exit()
	print(33 - mod)
	D = [2 ** i for i in range(31, -1, -1)]
	if mod == 0:
		D.append(1)
	print(' '.join(map(str, D)))
	for (x, y) in xy:
		temp = []
		for d in D:
			if x >= y and x + y >= 0:
				temp.append('R')
				x -= d
			elif x < y and x + y >= 0:
				temp.append('U')
				y -= d
			elif x >= y and x + y < 0:
				temp.append('D')
				y += d
			else:
				temp.append('L')
				x += d
		print(''.join(temp))
main()


n = int(input())
listXY = [list(map(int, input().split())) for _ in range(n)]
listUV = [[listXY[i][0] + listXY[i][1], listXY[i][0] - listXY[i][1]] for i in range(n)]
isOdd = listUV[0][0] % 2
canReach = 1
for i in range(1, n):
	if isOdd != listUV[i][0] % 2:
		canReach = 0
		break
if not canReach:
	print(-1)
else:
	offset = 2 ** 31 - isOdd
	m = 32 - isOdd
	d = [2 ** i for i in range(32)]
	w = []
	for i in range(n):
		(x, y) = (0, 0)
		(u, v) = (listUV[i][0] + offset, listUV[i][1] + offset)
		s = ''
		if not isOdd:
			s = 'L'
			x = x - 1
		for k in range(31):
			u //= 2
			v //= 2
			(u1, v1) = (u % 2, v % 2)
			if u1 == 0 and v1 == 1:
				s += 'D'
				y = y - d[k]
			elif u1 == 0 and v1 == 0:
				s += 'L'
				x = x - d[k]
			elif u1 == 1 and v1 == 1:
				s += 'R'
				x = x + d[k]
			elif u1 == 1 and v1 == 0:
				s += 'U'
				y = y + d[k]
		w.append(s)
	print(32 - isOdd)
	s = ''
	if not isOdd:
		s = '1 '
	for i in range(31):
		s += str(d[i]) + ' '
	print(s)
	for i in range(n):
		print(w[i])


def main():
	N = int(input())
	(X, Y) = zip(*(map(int, input().split()) for _ in range(N)))
	(m, d, w) = ref(N, X, Y)
	if m == -1:
		print(-1)
	else:
		print(m)
		print(*d)
		print(*w, sep='\n')

def ex1(N, X, Y):
	m = 2
	d = [1, 2]
	w = ['RL', 'UU', 'DR']
	return (m, d, w)

def part_300(N, X, Y):
	dists = []
	for (x, y) in zip(X, Y):
		dist = abs(x) + abs(y)
		dists.append(dist)
	m = -1
	d = []
	w = []
	mod = list(map(lambda x: x % 2, dists))
	if len(set(mod)) == 1:
		m = max(dists)
		d = [1] * m
		for (x, y, dist) in zip(X, Y, dists):
			x_dir = 'R' if x > 0 else 'L'
			y_dir = 'U' if y > 0 else 'D'
			_w = x_dir * abs(x) + y_dir * abs(y)
			rest = m - len(_w)
			if rest > 0:
				_w += 'LR' * (rest // 2)
			w.append(_w)
	return (m, d, w)

def editorial(N, X, Y):
	pass

def ref(N, X, Y):
	dists = []
	for (x, y) in zip(X, Y):
		dist = (abs(x) + abs(y)) % 2
		dists.append(dist)
	m = -1
	d = []
	w = []
	mod = set(map(lambda x: x % 2, dists))
	if len(mod) != 1:
		return (m, d, w)
	for i in range(30, 0 - 1, -1):
		d.append(1 << i)
	if 0 in mod:
		d.append(1)
	m = len(d)
	w1 = transform_xy(N, X, Y, d)
	return (m, d, w1)

def transform_xy(N, X, Y, d):
	trans_x = []
	trans_y = []
	for (x, y) in zip(X, Y):
		trans_x.append(x + y)
		trans_y.append(x - y)
	plot = False
	if plot:
		import matplotlib.pyplot as plt
		plt.axhline(0, linestyle='--')
		plt.axvline(0, linestyle='--')
		deno = 2 ** 0.5
		plt.scatter(X, Y, label='src')
		plt.scatter([x / deno for x in trans_x], [y / deno for y in trans_y], label='trans')
		for (x, y, x_src, y_src) in zip(trans_x, trans_y, X, Y):
			plt.text(x_src, y_src, str((x_src, y_src)))
			plt.text(x / deno, y / deno, str((x_src, y_src)))
		plt.legend()
		plt.show()
	w = []
	dirs = {(-1, -1): 'L', (+1, +1): 'R', (+1, -1): 'U', (-1, +1): 'D'}
	for (x, y) in zip(trans_x, trans_y):
		x_sum = 0
		y_sum = 0
		_w = ''
		for _d in d:
			if x_sum <= x:
				x_dir = 1
				x_sum += _d
			else:
				x_dir = -1
				x_sum -= _d
			if y_sum <= y:
				y_dir = 1
				y_sum += _d
			else:
				y_dir = -1
				y_sum -= _d
			_w += dirs[x_dir, y_dir]
		w.append(_w)
	return w

def no_transform_xy(N, X, Y, d):
	w = []
	for (x, y) in zip(X, Y):
		(x_sum, y_sum) = (0, 0)
		_w = ''
		for _d in d:
			if abs(x_sum - x) >= abs(y_sum - y):
				if x_sum >= x:
					x_sum -= _d
					_w += 'L'
				else:
					x_sum += _d
					_w += 'R'
			elif y_sum >= y:
				y_sum -= _d
				_w += 'D'
			else:
				y_sum += _d
				_w += 'U'
		w.append(_w)
	return w

def __starting_point():
	main()
__starting_point()


n = int(input())
xy = []
flag = 'f'
for i in range(0, n):
	(X, Y) = map(int, input().split())
	xy.append((X, Y))
	if i == 0:
		m = (X + Y) % 2
	if m != (X + Y) % 2:
		flag = 't'
if flag == 't':
	print(-1)
	exit()
d = [2 ** i for i in range(31, -1, -1)]
if m == 0:
	d.append(1)
print(len(d))
for i in range(0, len(d)):
	print(d[i], end=' ')
print()
for i in range(0, n):
	(x, y) = xy[i]
	w = ''
	for j in range(0, len(d)):
		if y <= x and y >= -x:
			w += 'R'
			x -= d[j]
		elif y >= x and y >= -x:
			w += 'U'
			y -= d[j]
		elif y > x and y < -x:
			w += 'L'
			x += d[j]
		else:
			w += 'D'
			y += d[j]
	print(w)


(n, *t) = map(int, open(0).read().split())
(*z,) = zip(t[::2], t[1::2])
s = set(((a + b) % 2 for (a, b) in z))
if len(s) > 1:
	print(-1)
	exit()
(s, *_) = s
d = [2 ** (38 - i) for i in range(39)] + [1] * (s < 1)
print(len(d))
print(*d)
for (a, b) in z:
	x = y = 0
	for i in d:
		if abs(a - x) > abs(b - y):
			if a - x > 0:
				print('R', end='')
				x += i
			else:
				print('L', end='')
				x -= i
		elif b - y > 0:
			print('U', end='')
			y += i
		else:
			print('D', end='')
			y -= i
	print()


def solve(n, x, y):
	ws = []
	S = set()
	for i in range(n):
		u = x[i] + y[i]
		v = x[i] - y[i]
		S.add(u % 2)
		if len(S) > 1:
			print(-1)
			return
		ds = [2 ** k for k in range(30, -1, -1)]
		if u % 2 == 0:
			ds.append(1)
		w = ''
		for d in ds:
			if u >= 0 and v >= 0:
				w += 'R'
				(u, v) = (u - d, v - d)
			elif u <= 0 and v <= 0:
				w += 'L'
				(u, v) = (u + d, v + d)
			elif u >= 0 and v <= 0:
				w += 'U'
				(u, v) = (u - d, v + d)
			else:
				w += 'D'
				(u, v) = (u + d, v - d)
		ws.append(w)
	print(len(ds))
	print(' '.join(map(str, ds)))
	print('\n'.join(ws))
n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
solve(n, x, y)


n = int(input())
x = [0 for i in range(0, n)]
y = [0 for i in range(0, n)]
for i in range(0, n):
	(x[i], y[i]) = [int(i) for i in input().split(' ')]
mod2 = (x[0] + y[0]) % 2
imp = False
for i in range(1, n):
	if (x[i] + y[i]) % 2 != mod2:
		print(-1)
		imp = True
		break
if not imp:
	if mod2 == 0:
		x = [i + 1 for i in x]
	u = [x[i] + y[i] for i in range(0, n)]
	v = [x[i] - y[i] for i in range(0, n)]
	mode = ['L', 'D', 'U', 'R']
	m = 31
	if mod2 == 0:
		print(m + 1)
		print('1 ' + ' '.join([str(2 ** (i - 1)) for i in range(1, m + 1)]))
	else:
		print(m)
		print(' '.join([str(2 ** (i - 1)) for i in range(1, m + 1)]))
	for i in range(0, n):
		w = ''
		if mod2 == 0:
			w = 'L'
		ui = (u[i] + 2 ** m - 1) // 2
		vi = (v[i] + 2 ** m - 1) // 2
		for l in range(0, m):
			ul = ui % 2
			ui = ui // 2
			vl = vi % 2
			vi = vi // 2
			w += mode[ul * 2 + vl]
		print(w)


N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

def parity():
	res = sum(xy[0]) % 2
	for (x, y) in xy:
		if (x + y) % 2 != res:
			return -1
	return res
p = parity()
if p == -1:
	print(-1)
	exit()
dd = [1]
if p == 0:
	dd.append(1)
lim = 10 ** 12
while len(dd) < 40 and dd[-1] * 2 <= lim:
	dd.append(dd[-1] * 2)
print(40)
print(*dd)
for (x, y) in xy:
	ans = ''
	for d in dd[::-1]:
		if abs(x) > abs(y):
			if x > 0:
				x -= d
				ans += 'R'
			else:
				x += d
				ans += 'L'
		elif y > 0:
			y -= d
			ans += 'U'
		else:
			y += d
			ans += 'D'
	print(ans[::-1])


n = int(input())
(p, d) = ([], [])
for _ in range(n):
	(x, y) = (int(i) for i in input().split())
	p.append((x, y))
a = sum(p[0]) % 2

def f(i, j):
	(s, s2, ans) = (bin((i + j + 2 ** 31 - 1) // 2)[::-1][:-2], bin((i - j + 2 ** 31 - 1) // 2)[::-1][:-2], '')
	(s, s2) = (s + (31 - len(s)) * '0', s2 + (31 - len(s2)) * '0')
	for i in range(31):
		if s[i] == s2[i] == '0':
			ans += 'L'
		elif s[i] == s2[i] == '1':
			ans += 'R'
		elif int(s[i]):
			ans += 'U'
		else:
			ans += 'D'
	return ans
if any((a != sum(p[i]) % 2 for i in range(n))):
	print(-1)
else:
	if a - 1:
		d.append('1')
	print(32 - a)
	for i in range(31):
		d.append(str(2 ** i))
	print(' '.join(d))
	if a:
		for (i, j) in p:
			print(f(i, j))
	else:
		for (i, j) in p:
			print('R' + f(i - 1, j))


inp = [[int(x) for x in input().split()] for _ in range(int(input()))]
inpsum = sum(map(lambda ij: abs(ij[0] + ij[1]) % 2, inp))
if not (inpsum == len(inp) or inpsum == 0):
	print(-1)
	exit(0)
seeds = ([] if inpsum == len(inp) else [1]) + [1 << i for i in range(0, 32)]
print(len(seeds))
print(' '.join(map(str, reversed(seeds))))
for (x, y) in inp:
	for k in reversed(seeds):
		res = ''
		if abs(x) > abs(y):
			if x > 0:
				res = 'R'
				x -= k
			else:
				res = 'L'
				x += k
		elif y > 0:
			res = 'U'
			y -= k
		else:
			res = 'D'
			y += k
		print(res, end='')
	print('')


import numpy as np
N = int(input())
XY = np.array([[int(x) for x in input().split()] for _ in range(N)], dtype=np.int64)
X = XY[:, 0]
Y = XY[:, 1]
command = np.array([''] * N, dtype=object)

def solve(k, X, Y, arms, command):
	if k == -1:
		return final_solve(X, Y, arms, command)
	else:
		bl_X = np.abs(X) > np.abs(Y)
		bl_Y = ~bl_X
		neg_X = X < 0
		neg_Y = Y < 0
		L = bl_X & neg_X
		R = bl_X & ~neg_X
		U = bl_Y & ~neg_Y
		D = bl_Y & neg_Y
		p = 1 << k
		command[L] += 'L'
		command[R] += 'R'
		command[U] += 'U'
		command[D] += 'D'
		X[L] += p
		X[R] -= p
		Y[U] -= p
		Y[D] += p
		arms.append(p)
		return solve(k - 1, X, Y, arms, command)

def final_solve(X, Y, arms, command):
	s = np.abs(X) + np.abs(Y)
	b0 = (s == 0).all()
	b1 = (s == 1).all()
	if b0:
		return (arms, command)
	elif not b1:
		return (None, None)
	arms.append(1)
	L = X == -1
	R = X == 1
	D = Y == -1
	U = Y == 1
	command[L] += 'L'
	command[R] += 'R'
	command[U] += 'U'
	command[D] += 'D'
	return (arms, command)
(arms, command) = solve(35, X, Y, [], command)
if arms is None:
	print(-1)
else:
	print(len(arms))
	print(' '.join([str(i) for i in arms]))
	print('\n'.join(command))


def solve():
	N = int(input())
	Z = [tuple(map(int, input().split())) for _ in [None] * N]
	p = set((z % 2 for z in map(sum, Z)))
	if len(p) == 2:
		res = '-1'
	else:
		res = ''
		(mode, *_) = p
		mode = 1 - mode
		D = [2 ** i for i in range(30, -1, -1)]
		res += str(31 + mode)
		res += '\n' + ' '.join((str(d) for d in D + [1] * mode))
		wdict = {(True, True): ('R', (1, 0)), (True, False): ('U', (0, 1)), (False, False): ('L', (-1, 0)), (False, True): ('D', (0, -1))}
		for (x, y) in Z:
			x -= mode
			W = '\n'
			for d in D:
				(w, (a, b)) = wdict[x + y > 0, x - y > 0]
				W += w
				x -= a * d
				y -= b * d
			W += 'R' * mode
			res += W
	return str(res)
print(solve())


def d_robot_arms(N, Pos):
	pos = []
	parity = (abs(Pos[0][0]) + abs(Pos[0][1])) % 2
	for (x, y) in Pos:
		parity_current = (abs(x) + abs(y)) % 2
		if parity != parity_current:
			return -1
		pos.append((x - y, x + y))
	arms = [1 << k for k in range(30, -1, -1)]
	if parity % 2 == 0:
		arms.append(1)
	ans_tmp = [str(len(arms)), ' '.join(list(map(str, arms)))]
	for (u_pos, v_pos) in pos:
		(u_sum, v_sum) = (0, 0)
		tmp = ''
		for arm_len in arms:
			u_dir = 1 if u_sum <= u_pos else -1
			u_sum += u_dir * arm_len
			v_dir = 1 if v_sum <= v_pos else -1
			v_sum += v_dir * arm_len
			if u_dir == 1 and v_dir == 1:
				tmp += 'R'
			elif u_dir == 1 and v_dir == -1:
				tmp += 'D'
			elif u_dir == -1 and v_dir == -1:
				tmp += 'L'
			else:
				tmp += 'U'
		ans_tmp.append(''.join(tmp))
	ans = '\n'.join(ans_tmp)
	return ans
N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(d_robot_arms(N, Pos))


import sys
input = sys.stdin.readline
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
p = set()
for i in range(N):
	p.add((XY[i][0] + XY[i][1]) % 2)
if len(p) > 1:
	print(-1)
	sys.exit()
if 0 in p:
	for i in range(N):
		XY[i][0] -= 1
D = []
for i in range(35):
	D.append(2 ** i)
D.sort(reverse=True)
Ans = []
for i in range(N):
	(x, y) = (XY[i][0], XY[i][1])
	(x0, y0) = (0, 0)
	ans = ''
	for d in D:
		(dx, dy) = (x - x0, y - y0)
		if dy < dx and dy > -dx:
			ans += 'R'
			x0 += d
		elif dy < dx and dy < -dx:
			ans += 'D'
			y0 -= d
		elif dy > dx and dy < -dx:
			ans += 'L'
			x0 -= d
		else:
			ans += 'U'
			y0 += d
	Ans.append(ans)
if 0 in p:
	D.append(1)
	print(len(D))
	print(' '.join(map(str, D)))
	for ans in Ans:
		print(ans + 'R')
else:
	print(len(D))
	print(' '.join(map(str, D)))
	for ans in Ans:
		print(ans)


N = int(input())
XY = []
for i in range(N):
	(x, y) = map(int, input().split())
	XY.append([x, y])
	if (XY[0][0] + XY[0][1]) % 2 != (XY[-1][0] + XY[-1][1]) % 2:
		print(-1)
		quit()
D = [2 ** i for i in range(31)]
if (XY[0][0] + XY[0][1]) % 2 == 0:
	D = [1] + D
print(len(D))
S = sum(D)
for d in D[::-1]:
	print(d, end=' ')
print()

def check(x, y, s):
	if abs(x) + abs(y) <= s:
		return True
	else:
		return False
for (x, y) in XY:
	s = S
	for d in D[::-1]:
		s -= d
		if check(x - d, y, s):
			print('R', end='')
			x -= d
		elif check(x + d, y, s):
			print('L', end='')
			x += d
		elif check(x, y + d, s):
			print('D', end='')
			y += d
		elif check(x, y - d, s):
			print('U', end='')
			y -= d
		else:
			print('WWWWWWWWWWWWWWWWWW')
			quit()
	print()


n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
p = x[0] + y[0] & 1
for i in range(n):
	if x[i] + y[i] & 1 != p:
		print(-1)
		exit()
d = ([1] if p == 0 else []) + [2 ** i for i in range(39)]
print(len(d))
print(*d)
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
ch = 'LDRU'
for i in range(n):
	(s, t) = (x[i], y[i])
	ans = []
	now = 2 ** 38
	for _ in range(len(d)):
		min_cur = 10 ** 18
		for i in range(4):
			(ts, tt) = (s + dx[i] * now, t + dy[i] * now)
			tm = abs(ts) + abs(tt)
			if tm < min_cur:
				(ns, nt) = (ts, tt)
				nc = ch[i]
				min_cur = tm
		(s, t) = (ns, nt)
		ans.append(nc)
		now = now // 2 if now > 1 else 1
	print(''.join(reversed(ans)))


N = int(input())
XY = [list(map(int, input().split())) for i in range(N)]
mods = [sum(xy) % 2 for xy in XY]
if not (sum(mods) == 0 or sum(mods) == N):
	print(-1)
	quit()
mod = mods[0] % 2
print(33 - mod)
D = [2 ** i for i in range(31, -1, -1)]
if mod == 0:
	D.append(1)
print(' '.join(map(str, D)))
for (x, y) in XY:
	temp = []
	for d in D:
		if x >= y and x + y >= 0:
			temp.append('R')
			x -= d
		elif x < y and x + y >= 0:
			temp.append('U')
			y -= d
		elif x >= y and x + y < 0:
			temp.append('D')
			y += d
		else:
			temp.append('L')
			x += d
	print(''.join(temp))


import sys
input = sys.stdin.readline
N = int(input())
a = []
mx = 0
for _ in range(N):
	(x, y) = map(int, input().split())
	u = x + y
	v = x - y
	a.append((u, v))
	mx = max(mx, max(abs(u), abs(v)))
t = a[0][0] % 2
for (u, _) in a:
	if u % 2 != t:
		print(-1)
		exit(0)
d = [pow(2, i) for i in range(mx.bit_length())]
if t == 0:
	d = [1] + d
print(len(d))
print(*d)
for (u, v) in a:
	s = [0] * len(d)
	t = [0] * len(d)
	x = 0
	y = 0
	res = []
	for i in range(len(d) - 1, -1, -1):
		z = d[i]
		if u < x:
			x -= z
			s[i] = -1
		else:
			x += z
			s[i] = 1
		if v < y:
			y -= z
			t[i] = -1
		else:
			y += z
			t[i] = 1
	for i in range(len(d)):
		if s[i] == 1 and t[i] == 1:
			res.append('R')
		elif s[i] == -1 and t[i] == -1:
			res.append('L')
		elif s[i] == 1 and t[i] == -1:
			res.append('U')
		elif s[i] == -1 and t[i] == 1:
			res.append('D')
	print(''.join(res))


N = int(input())
Points = [list(map(int, input().split())) for i in range(N)]
odds_even = set([(x + y) % 2 for (x, y) in Points])
if len(odds_even) != 1:
	print(-1)
	return
D = [2 ** i for i in range(39)]
D = D[::-1]
if odds_even == {0}:
	D.append(1)
print(len(D))
print(' '.join(map(str, D)))
for (tX, tY) in Points:
	(nX, nY) = (0, 0)
	ans = ''
	for d in D:
		(uX, uY) = (nX, nY + d)
		(rX, rY) = (nX + d, nY)
		(dX, dY) = (nX, nY - d)
		(lX, lY) = (nX - d, nY)
		diff_U = abs(tX - uX) + abs(tY - uY)
		diff_R = abs(tX - rX) + abs(tY - rY)
		diff_D = abs(tX - dX) + abs(tY - dY)
		diff_L = abs(tX - lX) + abs(tY - lY)
		Diff = [diff_U, diff_R, diff_D, diff_L]
		Command = ['U', 'R', 'D', 'L']
		Next = [[uX, uY], [rX, rY], [dX, dY], [lX, lY]]
		min_diff_index = Diff.index(min(Diff))
		ans += Command[min_diff_index]
		(nX, nY) = Next[min_diff_index]
	print(ans)


ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x % 2 else print('Even')
INF = 10 ** 18
N = ri()
U = [0] * N
V = [0] * N
parity = 0
for i in range(N):
	(x, y) = rl()
	(U[i], V[i]) = (format(x + y, '+032b'), format(x - y, '+032b'))
	parity += (x + y) % 2
if parity == 0 or parity == N:
	parity //= N
	m = 31 if parity else 32
	print(m)
	d = [1 for i in range(m)]
	for i in range(1, 31):
		d[i] = d[i - 1] * 2
	d.sort(reverse=True)
	print(*d, sep=' ')
	for i in range(N):
		res = ''
		(u, v) = (U[i], V[i])
		(ub, vb) = ([1] + list(map(int, u[1:-1])), [1] + list(map(int, v[1:-1])))
		if not parity:
			ub += [0]
			vb += [0]
		if u[0] == '-':
			ub = list(map(lambda x: x ^ 1, ub))
		if v[0] == '-':
			vb = list(map(lambda x: x ^ 1, vb))
		for (ub_, vb_) in zip(ub, vb):
			if ub_ == 0 and vb_ == 0:
				res += 'L'
			elif ub_ == 1 and vb_ == 1:
				res += 'R'
			elif ub_ == 0 and vb_ == 1:
				res += 'D'
			else:
				res += 'U'
		print(res)
else:
	print(-1)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N = INT()
XY = [[None] for i in range(N)]
(x, y) = MAP()
XY[0] = (x, y)
od_ev = (abs(x) + abs(y)) % 2
for i in range(1, N):
	(x, y) = MAP()
	if od_ev != (abs(y) + abs(x)) % 2:
		print(-1)
		exit()
	XY[i] = (x, y)
arms = []
for i in range(31, -1, -1):
	arms.append(2 ** i)
if od_ev == 0:
	arms.append(1)
print(len(arms))
print(*arms)
for i in range(N):
	ans = [''] * len(arms)
	(x, y) = XY[i]
	u = x + y
	v = x - y
	for (j, arm) in enumerate(arms):
		if u >= 0 and v >= 0:
			ans[j] = 'R'
			u -= arm
			v -= arm
		elif u >= 0 and v < 0:
			ans[j] = 'U'
			u -= arm
			v += arm
		elif u < 0 and v >= 0:
			ans[j] = 'D'
			u += arm
			v -= arm
		elif u < 0 and v < 0:
			ans[j] = 'L'
			u += arm
			v += arm
	print(''.join(ans))


(N, *XY) = map(int, open(0).read().split())
XY = list(zip(*[iter(XY)] * 2))
S = set(((x + y) % 2 for (x, y) in XY))
if len(S) == 2:
	print(-1)
	quit()
mod = S.pop()
D = [2 ** i for i in reversed(range(32))] + [1] * (mod == 0)
print(len(D))
print(*D)
for (x, y) in XY:
	A = []
	for d in D:
		if 0 <= x - y and 0 <= x + y:
			A.append('R')
			x -= d
		elif x - y < 0 and 0 <= x + y:
			A.append('U')
			y -= d
		elif 0 <= x - y and x + y < 0:
			A.append('D')
			y += d
		else:
			A.append('L')
			x += d
	print(''.join(A))


import sys
fin = sys.stdin.readline
N = int(fin())
coords = [[int(elem) for elem in fin().split(' ')] for _ in range(N)]
odd_or_even = abs((coords[0][0] + coords[0][1]) % 2)
max_sum = 0
for coord in coords:
	(x, y) = coord
	if (x + y) % 2 != odd_or_even:
		print(-1)
		exit(0)
	else:
		max_sum = max(max_sum, abs(x) + abs(y))

def partial_solution(max_sum, coords):
	m = max_sum
	print(m)
	print(' '.join(['1'] * m))
	for coord in coords:
		(x, y) = coord
		count = 0
		output = ''
		if x > 0:
			output += 'R' * x
		else:
			output += 'L' * abs(x)
		count += abs(x)
		if y > 0:
			output += 'U' * y
		else:
			output += 'D' * y
		count += abs(y)
		assert (m - count) % 2 == 0
		output += 'LR' * ((m - count) // 2)
		print(output)

def padding(binary_expression):
	len_pad = 31 - len(binary_expression[2:])
	return '0' * len_pad + binary_expression[2:]

def full_solution(max_sum, coords, odd_or_even):
	mode_map = {(0, 0): 'L', (1, 1): 'R', (0, 1): 'D', (1, 0): 'U'}
	rotated_coords = [(x + y, x - y) for (x, y) in coords]
	d = []
	for i in range(31):
		d.append(2 ** i)
	if odd_or_even == 1:
		m = 31
	else:
		m = 32
		d.append(1)
	print(m)
	print(' '.join([str(d_elem) for d_elem in d]))
	if odd_or_even == 1:
		for rotated_coord in rotated_coords:
			(u, v) = rotated_coord
			const_2pow31 = 2 ** 31
			flags_u = list(padding(bin((u + const_2pow31 - 1) // 2)))[::-1]
			flags_v = list(padding(bin((v + const_2pow31 - 1) // 2)))[::-1]
			flags = [(int(fu), int(fv)) for (fu, fv) in zip(flags_u, flags_v)]
			output = ''.join([mode_map[flag] for flag in flags])
			print(output)
	else:
		for rotated_coord in rotated_coords:
			(u, v) = rotated_coord
			u -= 1
			v -= 1
			const_2pow31 = 2 ** 31
			flags_u = list(padding(bin((u + const_2pow31 - 1) // 2)))[::-1]
			flags_v = list(padding(bin((v + const_2pow31 - 1) // 2)))[::-1]
			flags = [(int(fu), int(fv)) for (fu, fv) in zip(flags_u, flags_v)]
			output = ''.join([mode_map[flag] for flag in flags]) + 'R'
			print(output)
full_solution(max_sum, coords, odd_or_even)


import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 5)

def li():
	return map(int, stdin.readline().split())

def li_():
	return map(lambda x: int(x) - 1, stdin.readline().split())

def lf():
	return map(float, stdin.readline().split())

def ls():
	return stdin.readline().split()

def ns():
	return stdin.readline().rstrip()

def lc():
	return list(ns())

def ni():
	return int(stdin.readline())

def nf():
	return float(stdin.readline())
n = ni()
xy = []
for _ in range(n):
	(x, y) = li()
	xy.append((x, y))
exist = True
eo = (xy[0][0] + xy[0][1]) % 2
for (x, y) in xy[1:]:
	if (x + y) % 2 != eo:
		exist = False
if not exist:
	print(-1)
else:
	if eo == 1:
		arms = [2 ** i for i in range(40)]
		print(40)
		print(*arms[::-1])
	else:
		arms = [1] + [2 ** i for i in range(39)]
		print(40)
		print(*arms[::-1])
	for (x, y) in xy:
		(u, v) = (x - y, x + y)
		(ucur, vcur) = (0, 0)
		ans = ''
		for am in arms[::-1]:
			if ucur >= u and vcur >= v:
				ucur -= am
				vcur -= am
				ans += 'L'
			elif ucur <= u and vcur <= v:
				ucur += am
				vcur += am
				ans += 'R'
			elif ucur >= u and vcur <= v:
				ucur -= am
				vcur += am
				ans += 'U'
			elif ucur <= u and vcur >= v:
				ucur += am
				vcur -= am
				ans += 'D'
		print(ans)


from sys import stdin, exit
import numpy as np
(N, *XY) = map(int, stdin.read().split())
XY = np.array(XY).reshape(N, 2)
XYsum = np.abs(XY).sum(axis=1)
if any(XYsum % 2 != XYsum[0] % 2):
	print(-1)
	return
xymax = XYsum.max()
d = [] if xymax % 2 == 1 else [1]
for i in range(41):
	di = 2 ** i
	if xymax < di:
		break
	d.append(di)
d.reverse()
print(len(d))
print(' '.join(map(str, d)))
for (X, Y) in XY:
	(x, y) = (0, 0)
	w = ''
	for di in d:
		if abs(X - (x - di)) + abs(Y - y) <= di:
			w += 'L'
			x -= di
		elif abs(X - (x + di)) + abs(Y - y) <= di:
			w += 'R'
			x += di
		elif abs(X - x) + abs(Y - (y - di)) <= di:
			w += 'D'
			y -= di
		else:
			w += 'U'
			y += di
	print(w)