Bashar was practicing for the national programming contest. Because of sitting too much in front of the computer without doing physical movements and eating a lot Bashar became much fatter. Bashar is going to quit programming after the national contest and he is going to become an actor (just like his father), so he should lose weight.

In order to lose weight, Bashar is going to run for $k$ kilometers. Bashar is going to run in a place that looks like a grid of $n$ rows and $m$ columns. In this grid there are two one-way roads of one-kilometer length between each pair of adjacent by side cells, one road is going from the first cell to the second one, and the other road is going from the second cell to the first one. So, there are exactly $(4 n m - 2n - 2m)$ roads.

Let's take, for example, $n = 3$ and $m = 4$. In this case, there are $34$ roads. It is the picture of this case (arrows describe roads):

Bashar wants to run by these rules:

He starts at the top-left cell in the grid;

In one move Bashar may go up (the symbol 'U'), down (the symbol 'D'), left (the symbol 'L') or right (the symbol 'R'). More formally, if he stands in the cell in the row $i$ and in the column $j$, i.e. in the cell $(i, j)$ he will move to:

in the case 'U' to the cell $(i-1, j)$;

in the case 'D' to the cell $(i+1, j)$;

in the case 'L' to the cell $(i, j-1)$;

in the case 'R' to the cell $(i, j+1)$;

He wants to run exactly $k$ kilometers, so he wants to make exactly $k$ moves;

Bashar can finish in any cell of the grid;

He can't go out of the grid so at any moment of the time he should be on some cell;

Bashar doesn't want to get bored while running so he must not visit the same road twice. But he can visit the same cell any number of times.

Bashar asks you if it is possible to run by such rules. If it is possible, you should tell him how should he run.

You should give him $a$ steps to do and since Bashar can't remember too many steps, $a$ should not exceed $3000$. In every step, you should give him an integer $f$ and a string of moves $s$ of length at most $4$ which means that he should repeat the moves in the string $s$ for $f$ times. He will perform the steps in the order you print them.

For example, if the steps are $2$ RUD, $3$ UUL then the moves he is going to move are RUD $+$ RUD $+$ UUL $+$ UUL $+$ UUL $=$ RUDRUDUULUULUUL.

Can you help him and give him a correct sequence of moves such that the total distance he will run is equal to $k$ kilometers or say, that it is impossible?


-----Input-----

The only line contains three integers $n$, $m$ and $k$ ($1 \leq n, m \leq 500$, $1 \leq k \leq 10 ^{9}$), which are the number of rows and the number of columns in the grid and the total distance Bashar wants to run.


-----Output-----

If there is no possible way to run $k$ kilometers, print "NO" (without quotes), otherwise print "YES" (without quotes) in the first line.

If the answer is "YES", on the second line print an integer $a$ ($1 \leq a \leq 3000$) — the number of steps, then print $a$ lines describing the steps.

To describe a step, print an integer $f$ ($1 \leq f \leq 10^{9}$) and a string of moves $s$ of length at most $4$. Every character in $s$ should be 'U', 'D', 'L' or 'R'.

Bashar will start from the top-left cell. Make sure to move exactly $k$ moves without visiting the same road twice and without going outside the grid. He can finish at any cell.

We can show that if it is possible to run exactly $k$ kilometers, then it is possible to describe the path under such output constraints.


-----Examples-----

Input
3 3 4
Output
YES
2
2 R
2 L
Input
3 3 1000000000
Output
NO
Input
3 3 8
Output
YES
3
2 R
2 D
1 LLRR
Input
4 4 9
Output
YES
1
3 RLD
Input
3 4 16
Output
YES
8
3 R
3 L
1 D
3 R
1 D
1 U
3 L
1 D


-----Note-----

The moves Bashar is going to move in the first example are: "RRLL".

It is not possible to run $1000000000$ kilometers in the second example because the total length of the roads is smaller and Bashar can't run the same road twice.

The moves Bashar is going to move in the third example are: "RRDDLLRR".

The moves Bashar is going to move in the fifth example are: "RRRLLLDRRRDULLLD". It is the picture of his run (the roads on this way are marked with red and numbered in the order of his running):

Source: codeforces | Difficulty: HARD
Tags: Graph algorithms

Implementation

Constructive algorithms


Solutions:
import sys
readline = sys.stdin.readline

def solve(K):
	Ans = []
	if K > M - 1:
		K -= M - 1
		Ans.append(f'{M - 1} R')
	else:
		Ans.append(f'{K} R')
		return Ans
	if K > M - 1:
		K -= M - 1
		Ans.append(f'{M - 1} L')
	else:
		Ans.append(f'{K} L')
		return Ans
	cycle = 4 * M - 3
	if K > cycle * (N - 1):
		K -= cycle * (N - 1)
		for _ in range(N - 1):
			Ans.append(f'{M - 1} DRU')
			Ans.append('1 D')
			Ans.append(f'{M - 1} L')
	else:
		rot = K // cycle
		K -= rot * cycle
		for _ in range(rot):
			Ans.append(f'{M - 1} DRU')
			Ans.append('1 D')
			Ans.append(f'{M - 1} L')
		if K:
			if K < 3 * (M - 1):
				tc = K // 3
				if tc:
					Ans.append(f'{tc} DRU')
				K -= tc * 3
				if K:
					Ans.append('1 ' + 'DRU'[:K])
				return Ans
			else:
				K -= 3 * (M - 1)
				Ans.append(f'{M - 1} DRU')
			if not K:
				return Ans
			Ans.append('1 D')
			K -= 1
			if K:
				Ans.append(f'{K} L')
		return Ans
	if K:
		Ans.append(f'{K} U')
	return Ans

def solve2(K):
	Ans = []
	if K > N - 1:
		K -= N - 1
		Ans.append(f'{N - 1} D')
	else:
		Ans.append(f'{K} D')
		return Ans
	if K:
		Ans.append(f'{K} U')
	return Ans
(N, M, K) = map(int, readline().split())
if 4 * N * M - 2 * N - 2 * M < K:
	sys.stdout.write('NO\n')
else:
	sys.stdout.write('YES\n')
	if M != 1:
		Ans = solve(K)
	else:
		Ans = solve2(K)
	print(len(Ans))
	print('\n'.join(Ans))


import sys
(n, m, k) = map(int, input().split())
save_k = k
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	sys.exit()
arr = []
for i in ['R', 'L']:
	if k < 1:
		break
	arr.append((m - 1, i))
	k -= m - 1
for i in range(n - 1):
	if k < 1:
		break
	arr.append((1, 'D'))
	arr.append((m - 1, 'R'))
	arr.append((m - 1, 'UDL'))
	k -= 4 * m - 3
if k > 0:
	arr.append((k, 'U'))
k = save_k
ans = []
for (i, j) in arr:
	if i == 0:
		continue
	if k > i * len(j):
		ans.append((i, j))
		k -= i * len(j)
		continue
	if k // len(j) != 0:
		ans.append((k // len(j), j))
	if k % len(j) != 0:
		ans.append((1, j[:k % len(j)]))
	break
print(f'YES\n{len(ans)}')
for (i, j) in ans:
	print(i, j)


(n, m, k) = map(int, input().split())
ans = []
append = ans.append
(x, y) = (1, 1)
r_cnt = (m - 1) // 4
if r_cnt:
	ans.append((r_cnt, 'RRRR'))
x += r_cnt * 4
if x < m:
	ans.append((1, 'R' * (m - x) + 'L' * min(m - 1, 4 - (m - x))))
	x = m - min(m - 1, 4 - (m - x))
l_cnt = (x - 1) // 4
if l_cnt:
	ans.append((l_cnt, 'LLLL'))
x -= l_cnt * 4
if x > 1:
	ans.append((1, 'L' * (x - 1)))
if n > 1:
	ans.append((1, 'D'))
(x, y) = (1, 2)
for y in range(2, n + 1):
	if m > 1:
		ans.append((m - 1, 'RUD'))
	if m > 4:
		ans.append(((m - 1) // 4, 'LLLL'))
	if y < n:
		ans.append((1, 'L' * ((m - 1) % 4) + 'D'))
	elif (m - 1) % 4:
		ans.append((1, 'L' * ((m - 1) % 4)))
if n > 4:
	ans.append(((n - 1) // 4, 'UUUU'))
if (n - 1) % 4:
	ans.append((1, 'U' * ((n - 1) % 4)))
steps = sum((x[0] * len(x[1]) for x in ans))
ans2 = []
if steps < k:
	print('NO')
else:
	print('YES')
	for (cnt, s) in ans:
		if len(s) * cnt <= k:
			ans2.append('{} {}'.format(cnt, s))
			k -= len(s) * cnt
			if k == 0:
				break
		else:
			c = k // len(s)
			if c:
				ans2.append('{} {}'.format(c, s))
			if k % len(s):
				ans2.append('{} {}'.format(1, s[:k % len(s)]))
			break
	print(len(ans2))
	print(*ans2, sep='\n')


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	exit(0)
else:
	print('YES')
j = 1
ans = []
if m - 1 > 0:
	ans.append((m - 1, 'R'))
	ans.append((m - 1, 'L'))
while j < n:
	ans.append((1, 'D'))
	j += 1
	if m - 1 > 0:
		ans.append((m - 1, 'R'))
	if m - 1 > 0:
		ans.append((m - 1, 'UDL'))
if n - 1 > 0:
	ans.append((n - 1, 'U'))
answer = []
L = 0
i = 0
while L < k:
	if k - L >= ans[i][0] * len(ans[i][1]):
		answer.append(ans[i])
		L += ans[i][0] * len(ans[i][1])
		i += 1
	else:
		break
if k != L:
	if (k - L) // len(ans[i][1]) != 0:
		answer.append(((k - L) // len(ans[i][1]), ans[i][1]))
	L += (k - L) // len(ans[i][1]) * len(ans[i][1])
	if k != L:
		answer.append((1, ans[i][1][:k - L]))
print(len(answer))
for i in answer:
	print(*i)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
if k > 4 * (n * m) - 2 * n - 2 * m:
	print('NO')
else:
	count = 0
	ans = []
	if m == 1:
		if k > 0:
			ans.append((min(n - 1, k), 'D'))
			k -= min(n - 1, k)
			count += 1
		if k > 0:
			ans.append((min(n - 1, k), 'U'))
			k -= min(n - 1, k)
			count += 1
	if n == 1:
		if k > 0:
			ans.append((min(m - 1, k), 'R'))
			k -= min(m - 1, k)
			count += 1
		if k > 0:
			ans.append((min(m - 1, k), 'L'))
			k -= min(m - 1, k)
			count += 1
	else:
		while n > 1:
			if k > 0:
				ans.append((min(m - 1, k), 'R'))
				k -= min(m - 1, k)
				count += 1
			if k > 2:
				if k >= (m - 1) * 3:
					ans.append((m - 1, 'DUL'))
					k -= (m - 1) * 3
					count += 1
				else:
					ans.append((k // 3, 'DUL'))
					k -= k // 3 * 3
					count += 1
					if k > 0:
						if k == 1:
							ans.append((1, 'D'))
							count += 1
							k -= 1
						elif k == 2:
							ans.append((1, 'DU'))
							count += 1
							k -= 2
			elif k == 1:
				ans.append((1, 'D'))
				count += 1
				k -= 1
			elif k == 2:
				ans.append((1, 'DU'))
				count += 1
				k -= 2
			if k > 0:
				ans.append((1, 'D'))
				k -= 1
				count += 1
			n -= 1
		if k > 0:
			ans.append((min(m - 1, k), 'R'))
			k -= min(m - 1, k)
			count += 1
		if k > 0:
			ans.append((min(m - 1, k), 'L'))
			k -= min(m - 1, k)
			count += 1
		if k > 0:
			ans.append((k, 'U'))
			k -= k
			count += 1
	print('YES')
	print(count)
	for (j, jk) in ans:
		print(j, jk)


import math
import collections
import sys

def inpu():
	return input().split(' ')

def inti(a):
	for i in range(len(a)):
		a[i] = int(a[i])
	return a

def inp():
	a = inpu()
	a = inti(a)
	return a

def solution():
	(n, m, k) = map(int, input().split())
	c = 0
	i = 0
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
		exit(0)
	d = []
	m -= 1
	while True:
		if i == 0:
			if k <= m and m > 0:
				d.append([k, 'R'])
				break
			if m > 0:
				d.append([m, 'R'])
				c += m
			if c + m >= k and m > 0:
				d.append([k - c, 'L'])
				break
			elif m > 0:
				d.append([m, 'L'])
				c += m
			d.append([1, 'D'])
			c += 1
			if c == k:
				break
		elif i != n - 1:
			if c + m >= k and m > 0:
				d.append([k - c, 'R'])
				break
			elif m > 0:
				d.append([m, 'R'])
				c += m
			if (k - c) // 3 < m:
				if (k - c) // 3 > 0:
					d.append([(k - c) // 3, 'UDL'])
				if (k - c) % 3 > 0:
					d.append([1, 'UDL'[:(k - c) % 3]])
				break
			elif (k - c) // 3 == m and (k - c) % 3 == 0 and (m > 0):
				d.append([(k - c) // 3, 'UDL'])
				break
			elif m > 0:
				d.append([m, 'UDL'])
				c += m * 3
			d.append([1, 'D'])
			c += 1
			if c == k:
				break
		else:
			if c + m >= k and m > 0:
				d.append([k - c, 'R'])
				break
			elif m > 0:
				d.append([m, 'R'])
				c += m
			if (k - c) // 3 < m:
				if (k - c) // 3 > 0:
					d.append([(k - c) // 3, 'UDL'])
				if (k - c) % 3 > 0:
					d.append([1, 'UDL'[:(k - c) % 3]])
				break
			elif (k - c) // 3 == m and (k - c) % 3 == 0 and (m > 0):
				d.append([(k - c) // 3, 'UDL'])
				break
			elif m > 0:
				d.append([m, 'UDL'])
				c += m * 3
			d.append([k - c, 'U'])
			break
		i += 1
	print('YES')
	print(len(d))
	for i in d:
		print(*i)
solution()


ans = [0]

def insert(x: int, y: str):
	global ans
	ans[0] += 1
	ans.append(x)
	ans.append(y)
(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	print('YES')
	if m == 1:
		if k <= n - 1:
			insert(k, 'D')
		else:
			insert(n - 1, 'D')
			insert(k - (n - 1), 'U')
	elif k <= m - 1:
		insert(k, 'R')
	elif k <= 2 * (m - 1):
		insert(m - 1, 'R')
		insert(k - (m - 1), 'L')
	else:
		k -= 2 * (m - 1)
		insert(m - 1, 'R')
		insert(m - 1, 'L')
		level = k // (1 + 4 * (m - 1))
		if level <= n - 1:
			for i in range(level):
				insert(1, 'D')
				insert(m - 1, 'RUD')
				insert(m - 1, 'L')
			k -= level * (1 + 4 * (m - 1))
			if level == n - 1:
				if k > 0:
					insert(k, 'U')
			else:
				if k > 0:
					k -= 1
					insert(1, 'D')
				if k > 0:
					if k <= 3 * (m - 1):
						times = k // 3
						k -= times * 3
						if times:
							insert(times, 'RUD')
						if k == 1:
							insert(1, 'R')
						elif k == 2:
							insert(1, 'RU')
						elif k == 3:
							insert(1, 'RUD')
					else:
						k -= 3 * (m - 1)
						insert(m - 1, 'RUD')
						insert(k, 'L')
		else:
			for i in range(n - 1):
				insert(1, 'D')
				insert(m - 1, 'RUD')
				insert(m - 1, 'L')
			k -= (n - 1) * (1 + 4 * (m - 1))
			insert(k, 'L')
	print(ans[0])
	for i in range(1, len(ans), 2):
		print(ans[i], ans[i + 1])


(n, m, k) = map(int, input().strip().split())
steps = []
if max(n, m) == 1:
	print('NO')
	exit()
elif n == 1:
	steps.append((m - 1, 'R'))
	steps.append((m - 1, 'L'))
elif m == 1:
	steps.append((n - 1, 'D'))
	steps.append((n - 1, 'U'))
elif n >= m:
	for _ in range(m - 1):
		steps.append((n - 1, 'DRL'))
		steps.append((n - 1, 'U'))
		steps.append((1, 'R'))
	steps.append((n - 1, 'D'))
	steps.append((n - 1, 'U'))
	steps.append((m - 1, 'L'))
else:
	for _ in range(n - 1):
		steps.append((m - 1, 'RDU'))
		steps.append((m - 1, 'L'))
		steps.append((1, 'D'))
	steps.append((m - 1, 'R'))
	steps.append((m - 1, 'L'))
	steps.append((n - 1, 'U'))
have = 0
ret = []
for (count, s) in steps:
	if have + count * len(s) <= k:
		ret.append((count, s))
		have += count * len(s)
	else:
		need = k - have
		ls = len(s)
		div = need // ls
		if div != 0:
			ret.append((div, s))
		rem = need % ls
		if rem != 0:
			ret.append((1, s[:rem]))
		have = k
		break
if have == k and len(ret) <= 3000:
	print('YES')
	print(len(ret))
	for (count, s) in ret:
		print(count, s)
else:
	print('NO')


def loopRight(path):
	path.append('DUR')

def loopLeft(path):
	path.append('DUL')

def straightRight(path, n):
	path.append('R' * (n - 1))

def straightLeft(path, n):
	path.append('L' * (n - 1))

def main():
	(n, m, k) = readIntArr()
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
		return
	temp = n
	n = m
	m = temp
	path = []
	for row in range(m - 1):
		if row % 2 == 0:
			path.append(['DUR', n - 1])
		else:
			path.append(['DUL', n - 1])
		path.append(['D', 1])
	if m % 2 == 1:
		path.append(['R', n - 1])
	else:
		path.append(['L', n - 1])
	for row in range(m - 1, -1, -1):
		if row % 2 == 0:
			path.append(['L', n - 1])
		else:
			path.append(['R', n - 1])
		if row > 0:
			path.append(['U', 1])
	ans = []
	l = 0
	for (combo, counts) in path:
		z = len(combo)
		if l + z * counts <= k:
			ans.append([counts, combo])
			l += z * counts
		else:
			i = 0
			while l + z * (i + 1) <= k:
				i += 1
			assert i <= counts
			if i > 0:
				ans.append([i, combo])
				l += z * i
			while l < k:
				for c in combo:
					ans.append([1, c])
					l += 1
					if l == k:
						break
		if l == k:
			break
	ans2 = []
	for (cnt, combo) in ans:
		if cnt > 0:
			ans2.append([cnt, combo])
	ans = ans2
	print('YES')
	print(len(ans))
	multiLineArrayOfArraysPrint(ans)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(*args):
	assert len(args) >= 2, 'makeArr args should be (default value, dimension 1, dimension 2,...'
	if len(args) == 2:
		return [args[0] for _ in range(args[1])]
	else:
		return [makeArr(args[0], *args[2:]) for _ in range(args[1])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


(n, m, k) = map(int, input().split())
s = ('RLD' * (n - 1) + 'R' + 'RLU' * (n - 1) + 'R') * ((m - 1) // 2)
if m % 2 == 0:
	s += 'RLD' * (n - 1) + 'R' + 'U' * (n - 1) + 'D' * (n - 1) + 'L' + 'U' * (n - 1)
else:
	s += 'D' * (n - 1) + 'U' * (n - 1)
s += ('L' + 'D' * (n - 1) + 'L' + 'U' * (n - 1)) * ((m - 1) // 2)
if len(s) < k:
	print('NO')
else:
	print('YES')
	ans = []
	s = s[:k]
	i = 0
	while i < k:
		if s[i:i + 3] == 'RLD':
			cnt = 0
			while s[i:i + 3] == 'RLD':
				cnt += 1
				i += 3
			ans.append(str(cnt) + ' RLD')
		elif s[i:i + 3] == 'RLU':
			cnt = 0
			while s[i:i + 3] == 'RLU':
				cnt += 1
				i += 3
			ans.append(str(cnt) + ' RLU')
		elif s[i:i + 3] == 'UUU':
			cnt = 0
			while s[i:i + 2] == 'UU':
				cnt += 1
				i += 1
			cnt += 1
			i += 1
			ans.append(str(cnt) + ' U')
		elif s[i:i + 3] == 'DDD':
			cnt = 0
			while s[i:i + 2] == 'DD':
				cnt += 1
				i += 1
			cnt += 1
			i += 1
			ans.append(str(cnt) + ' D')
		else:
			ans.append('1 ' + s[i])
			i += 1
	print(len(ans))
	for item in ans:
		print(item)


import sys
input = sys.stdin.readline
(N, M, K) = map(int, input().split())
if K > N * (M - 1) * 2 + M * (N - 1) * 2:
	print('NO')
else:
	print('YES')
	ans = [(M - 1, 'R'), (M - 1, 'L')]
	for _ in range(N - 1):
		ans.append((1, 'D'))
		ans.append((M - 1, 'RUD'))
		ans.append((M - 1, 'L'))
	ans.append((N - 1, 'U'))
	num = 0
	P = []
	for (n, S) in ans:
		if n == 0:
			continue
		if num + n * len(S) <= K:
			P.append((n, S))
			num += n * len(S)
		else:
			rem = K - num
			p = rem // len(S)
			if p:
				P.append((p, S))
			ss = S[:rem % len(S)]
			if ss:
				P.append((1, ss))
			break
	print(len(P))
	for (n, s) in P:
		print(n, s)


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 list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(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(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(H, W, K) = MAP()
L = 'L'
R = 'R'
D = 'D'
U = 'U'
mx = 4 * H * W - 2 * H - 2 * W
if mx < K:
	NO()
	exit()

def opr(dist, dir):
	global cnt
	if cnt - dist <= 0:
		ans.append((cnt, dir))
		cnt = 0
		return True
	else:
		ans.append((dist, dir))
		cnt -= dist
		return False
ans = []
cnt = K
i = 0
while i < W - 1:
	if H > 1:
		if opr(H - 1, D):
			break
		if opr(H - 1, U):
			break
	if opr(1, R):
		break
	i += 1
i = 0
while cnt > 0 and i < H - 1:
	if opr(1, D):
		break
	if W > 1:
		if opr(W - 1, L):
			break
		if opr(W - 1, R):
			break
	i += 1
if cnt > 0:
	for _ in range(1):
		if H > 1:
			if opr(H - 1, U):
				break
		if W > 1:
			if opr(W - 1, L):
				break
YES()
print(len(ans))
[print(a, b) for (a, b) in ans]


def main():
	from sys import stdin, stdout
	(n, m, k) = map(int, stdin.readline().split())
	ans = []
	for (f, s) in ((1, 'D'), (m - 1, 'R'), (m - 1, 'L')) * (n - 1) + ((n - 1, 'U'),) + ((1, 'R'), (n - 1, 'D'), (n - 1, 'U')) * (m - 1) + ((m - 1, 'L'),):
		if f:
			k -= f
			if k <= 0:
				f += k
			ans.append((f, s))
			if k <= 0:
				break
	else:
		stdout.write('NO')
		return
	stdout.write(f'YES\n{len(ans)}')
	for (f, s) in ans:
		stdout.write(f'\n{f} {s}')
main()


import sys
(n, m, k) = map(int, sys.stdin.readline().split())
ans = []
if m == 1:
	if k > 2 * (n - 1):
		print('NO')
	else:
		print('YES')
		if k > n - 1:
			print(2)
			print(n - 1, 'D')
			print(k - (n - 1), 'U')
		else:
			print(1)
			print(k, 'D')
elif n == 1:
	if k > 2 * (m - 1):
		print('NO')
	else:
		print('YES')
		if k > m - 1:
			print(2)
			print(m - 1, 'R')
			print(k - (m - 1), 'L')
		else:
			print(1)
			print(k, 'R')
elif k <= m - 1:
	print('YES')
	print(1)
	print(k, 'R')
elif k <= 2 * (m - 1):
	print('YES')
	print(2)
	print(m - 1, 'R')
	print(k - m + 1, 'L')
else:
	ans.append([m - 1, 'R'])
	ans.append([m - 1, 'L'])
	k -= 2 * (m - 1)
	z = True
	k -= 1
	ans.append([1, 'D'])
	for i in range(1, n):
		if k == 0:
			z = False
			break
		if k >= m - 1:
			k -= m - 1
			ans.append([m - 1, 'R'])
		else:
			ans.append([k, 'R'])
			k = 0
			z = False
			break
		s = 'UDL'
		if k >= 3 * (m - 1):
			ans.append([m - 1, s])
			k -= 3 * (m - 1)
		else:
			x = k // 3
			if x > 0:
				ans.append([x, s])
				k -= 3 * x
			x = k % 3
			if x > 0:
				ans.append([1, s[:x]])
				k -= x
		if k >= 1 and i != n - 1:
			k -= 1
			ans.append([1, 'D'])
	if z:
		if k > n - 1:
			print('NO')
		else:
			if k != 0:
				ans.append([k, 'U'])
			print('YES')
			print(len(ans))
			for i in range(len(ans)):
				print(ans[i][0], ans[i][1])
	else:
		print('YES')
		print(len(ans))
		for i in range(len(ans)):
			print(ans[i][0], ans[i][1])


def output_ans(ans):
	print('YES')
	print(len(ans))
	for x in ans:
		print(x[0], x[1])
(n, m, k) = [int(x) for x in input().split(' ')]
ans_list = list()
ans_list.append((m - 1, 'R'))
ans_list.append((m - 1, 'L'))
for _ in range(n - 1):
	ans_list.append((1, 'D'))
	ans_list.append((m - 1, 'RUD'))
	ans_list.append((m - 1, 'L'))
ans_list.append((n - 1, 'U'))
count = 0
ans = list()
for op in ans_list:
	if op[0] == 0:
		continue
	for x in range(op[0]):
		for j in range(len(op[1])):
			count += 1
			if count == k:
				if x > 0:
					ans.append((x, op[1]))
				ans.append((1, op[1][0:j + 1]))
				output_ans(ans)
				exit(0)
	ans.append((op[0], op[1]))
if k > count:
	print('NO')
	exit(0)
output_ans(ans)


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	lt = []
	sm = 0
	b = False
	for i in range(n):
		s = 0
		for j in range(m):
			if j + 1 < m:
				s += 1
				sm += 1
				if sm == k:
					b = True
					break
				if i + 1 < n:
					s += 1
					sm += 1
					if sm == k:
						b = True
						break
					s += 1
					sm += 1
					if sm == k:
						b = True
						break
		if b == True:
			if i == n - 1:
				lt.append(str(s) + ' R')
				break
			else:
				l = s
				r = l % 3
				q = l // 3
				if q > 0:
					lt.append(str(q) + ' RDU')
				if r == 1:
					lt.append('1 R')
				elif r == 2:
					lt.append('1 RD')
				break
		elif i == n - 1 and m - 1 > 0:
			lt.append(str(m - 1) + ' R')
		elif m - 1 > 0:
			lt.append(str(m - 1) + ' RDU')
		if sm + m - 1 >= k:
			lt.append(str(k - sm) + ' L')
			sm = k
			break
		elif m - 1 > 0:
			sm += m - 1
			lt.append(str(m - 1) + ' L')
		if i == n - 1:
			break
		sm += 1
		lt.append('1 D')
		if sm == k:
			break
	if sm < k:
		lt.append(str(k - sm) + ' U')
	print('YES')
	print(len(lt))
	for i in lt:
		print(i)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

def solve(N, M, K):
	if K > 4 * N * M - 2 * N - 2 * M:
		print('NO')
		return
	ans = []
	if M == 1:
		if K <= N - 1:
			ans.append('{} {}'.format(K, 'D'))
		else:
			ans.append('{} {}'.format(N - 1, 'D'))
			ans.append('{} {}'.format(K - N + 1, 'U'))
	elif K <= M - 1:
		ans.append('{} {}'.format(K, 'R'))
	elif K <= 2 * (M - 1):
		ans.append('{} {}'.format(M - 1, 'R'))
		ans.append('{} {}'.format(K - M + 1, 'L'))
	else:
		ans.append('{} {}'.format(M - 1, 'R'))
		ans.append('{} {}'.format(M - 1, 'L'))
		d = 2 * (M - 1)
		row = 1
		while row < N and d < K:
			row += 1
			if d + 1 <= K:
				ans.append('{} {}'.format(1, 'D'))
				d += 1
			if d < K:
				dd = min(M - 1, K - d)
				ans.append('{} {}'.format(dd, 'R'))
				d += dd
			if d < K:
				dd = min((K - d) // 3, M - 1)
				if dd > 0:
					ans.append('{} {}'.format(dd, 'UDL'))
					d += dd * 3
				if dd < M - 1 and 0 < K - d < 3:
					ans.append('{} {}'.format(1, 'UDL'[:K - d]))
					d = K
		if d < K:
			ans.append('{} {}'.format(K - d, 'U'))
	print('YES')
	print(len(ans))
	print('\n'.join(ans))
(N, M, K) = map(int, input().split())
solve(N, M, K)


(n, m, k) = [int(x) for x in input().split()]
outputs = ['0 0000']

def main(n, m, k, outputs):
	for i in range(m - 1):
		if k <= 3 * n - 3:
			if k >= 3:
				outputs.append('{:} RDL'.format(k // 3))
			if k % 3 == 1:
				outputs.append('1 R')
			if k % 3 == 2:
				outputs.append('1 RD')
			return (outputs, 0)
		k -= 3 * n - 3
		if n - 1:
			outputs.append('{:} RDL'.format(n - 1))
		if k <= n:
			outputs.append('1 R')
			for i in range(1, k):
				if len(outputs[-1].split()[1]) == 4:
					outputs.append('1 ')
				outputs[-1] += 'U'
			return (outputs, 0)
		outputs.append('1 R')
		for i in range(1, n):
			if len(outputs[-1].split()[1]) == 4:
				outputs.append('1 ')
			outputs[-1] += 'U'
		k -= n
	if k < m:
		for i in range(k):
			if len(outputs[-1].split()[1]) == 4:
				outputs.append('1 ')
			outputs[-1] += 'L'
		return (outputs, 0)
	for i in range(m - 1):
		if len(outputs[-1].split()[1]) == 4:
			outputs.append('1 ')
		outputs[-1] += 'L'
	k -= m - 1
	if k < n:
		for i in range(k):
			if len(outputs[-1].split()[1]) == 4:
				outputs.append('1 ')
			outputs[-1] += 'D'
		return (outputs, 0)
	for i in range(n - 1):
		if len(outputs[-1].split()[1]) == 4:
			outputs.append('1 ')
		outputs[-1] += 'D'
	k -= n - 1
	if k < n:
		for i in range(k):
			if len(outputs[-1].split()[1]) == 4:
				outputs.append('1 ')
			outputs[-1] += 'U'
		return (outputs, 0)
	for i in range(n - 1):
		if len(outputs[-1].split()[1]) == 4:
			outputs.append('1 ')
		outputs[-1] += 'U'
	k -= n - 1
	return (-1, -1)
(outputs, k) = main(n, m, k, outputs)
if k == 0:
	print('YES')
	last = outputs[0].split()[1]
	c = int(outputs[0].split()[0])
	temp = []
	for i in range(1, len(outputs)):
		if last == outputs[i].split()[1]:
			c += int(outputs[i].split()[0])
		else:
			temp.append('{:} {:}'.format(c, last))
			last = outputs[i].split()[1]
			c = int(outputs[i].split()[0])
	temp.append('{:} {:}'.format(c, last))
	outputs = temp
	print(len(outputs) - 1)
	for x in outputs[1:]:
		print(x)
else:
	print('NO')


(n, m, k) = list(map(int, input().strip().split()))
a = 4 * n * m - 2 * n - 2 * m
if k > a:
	print('NO')
else:
	print('YES')
	if m == 1:
		a = []
		a.append([n - 1, 'D'])
		a.append([n - 1, 'U'])
		b = 0
		c = []
		while k > 0:
			k = k - a[b][0] * len(a[b][1])
			if k >= 0:
				c.append(a[b])
				b = b + 1
			else:
				k = k + a[b][0] * len(a[b][1])
				if k // len(a[b][1]) != 0:
					c.append([k // len(a[b][1]), a[b][1]])
				k = k % len(a[b][1])
				if k != 0:
					c.append([1, a[b][1][:k]])
				k = k - a[b][0] * len(a[b][1])
				b = b + 1
		print(len(c))
		for i in range(len(c)):
			print(*c[i])
	elif n == 1:
		a = []
		a.append([m - 1, 'R'])
		a.append([m - 1, 'L'])
		b = 0
		c = []
		while k > 0:
			k = k - a[b][0] * len(a[b][1])
			if k >= 0:
				c.append(a[b])
				b = b + 1
			else:
				k = k + a[b][0] * len(a[b][1])
				if k // len(a[b][1]) != 0:
					c.append([k // len(a[b][1]), a[b][1]])
				k = k % len(a[b][1])
				if k != 0:
					c.append([1, a[b][1][:k]])
				k = k - a[b][0] * len(a[b][1])
				b = b + 1
		print(len(c))
		for i in range(len(c)):
			print(*c[i])
	else:
		a = []
		a.append([m - 1, 'R'])
		a.append([n - 1, 'D'])
		a.append([n - 1, 'LRU'])
		for i in range(m - 2):
			a.append([1, 'L'])
			a.append([n - 1, 'D'])
			a.append([n - 1, 'LRU'])
		a.append([1, 'L'])
		a.append([n - 1, 'D'])
		a.append([n - 1, 'U'])
		b = 0
		c = []
		while k > 0:
			k = k - a[b][0] * len(a[b][1])
			if k >= 0:
				c.append(a[b])
				b = b + 1
			else:
				k = k + a[b][0] * len(a[b][1])
				if k // len(a[b][1]) != 0:
					c.append([k // len(a[b][1]), a[b][1]])
				k = k % len(a[b][1])
				if k != 0:
					c.append([1, a[b][1][:k]])
				k = k - a[b][0] * len(a[b][1])
				b = b + 1
		print(len(c))
		for i in range(len(c)):
			print(*c[i])


from __future__ import division, print_function
import os
import sys, math
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	(n, m, k) = map(int, input().split())
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
		return
	print('YES')
	v = list()
	ans = list()
	for i in range(n):
		if m - 1:
			v.append((m - 1, 'R'))
			v.append((m - 1, 'L'))
		v.append((1, 'D'))
	v.pop()
	if m - 1:
		v.pop()
	for i in range(m):
		if n - 1:
			v.append((n - 1, 'U'))
			v.append((n - 1, 'D'))
		v.append((1, 'L'))
	v.pop()
	if n - 1:
		v.pop()
	ind = 0
	while k:
		if k >= v[ind][0]:
			ans.append(v[ind])
			k -= v[ind][0]
		else:
			ans.append((k, v[ind][1]))
			k = 0
		ind += 1
	print(len(ans))
	for val in ans:
		print(val[0], val[1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def main():
	import sys
	input = sys.stdin.readline
	(N, M, K) = map(int, input().split())
	if 4 * N * M - 2 * N - 2 * M < K:
		print('NO')
		exit()
	print('YES')

	def finish(ans):
		print(len(ans))
		for (a, b) in ans:
			print(a, b)
		exit()
	ans = []
	ans_append = ans.append
	if N == 1:
		if M - 1 >= K:
			ans_append((K, 'R'))
			finish(ans)
		else:
			ans_append((M - 1, 'R'))
			ans_append((K - M + 1, 'L'))
			finish(ans)
	if N - 1 >= K:
		ans_append((K, 'D'))
		finish(ans)
	else:
		ans_append((N - 1, 'D'))
		K -= N - 1
	if N - 1 >= K:
		ans_append((K, 'U'))
		finish(ans)
	else:
		ans_append((N - 1, 'U'))
		K -= N - 1
	for w in range(M - 1):
		ans_append((1, 'R'))
		K -= 1
		if K == 0:
			finish(ans)
		if 3 * (N - 1) < K:
			ans_append((N - 1, 'DLR'))
			K -= 3 * (N - 1)
		else:
			j = K // 3
			if j:
				ans_append((j, 'DLR'))
				K -= j * 3
			if K == 0:
				finish(ans)
			elif K == 1:
				ans_append((1, 'D'))
				finish(ans)
			elif K == 2:
				ans_append((1, 'DL'))
				finish(ans)
		if N - 1 >= K:
			ans_append((K, 'U'))
			finish(ans)
		else:
			ans_append((N - 1, 'U'))
			K -= N - 1
	ans_append((K, 'L'))
	finish(ans)
main()


import sys
input = sys.stdin.readline
l = input().split()
n = int(l[0])
m = int(l[1])
k = int(l[2])
tot = 2 * (2 * n * m - n - m)
if k > tot:
	print('NO')
	quit()
l = []
if m > 1:
	l.append((m - 1, 'R'))
	l.append((m - 1, 'L'))
if n > 1:
	l.append((1, 'D'))
for i in range(n - 1):
	if m > 1:
		l.append((m - 1, 'R'))
		l.append((m - 1, 'UDL'))
	if i != n - 2:
		l.append((1, 'D'))
	else:
		l.append((n - 1, 'U'))
print('YES')
lfi = []
for i in l:
	if i[0] * len(i[1]) <= k:
		lfi.append(i)
		k -= i[0] * len(i[1])
	else:
		z = k // len(i[1])
		if z:
			lfi.append((z, i[1]))
		y = k % len(i[1])
		for j in range(y):
			lfi.append((1, i[1][j]))
		break
print(len(lfi))
for i in lfi:
	print(i[0], i[1])


(n, m, k) = (int(i) for i in input().split(' '))
path = []
tot = 0
for i in range(n):
	path.append((m - 1, 'R'))
	tot += path[-1][0] * len(path[-1][1])
	if i == 0:
		path.append((m - 1, 'L'))
	else:
		path.append((m - 1, 'UDL'))
	tot += path[-1][0] * len(path[-1][1])
	if i == n - 1:
		path.append((n - 1, 'U'))
	else:
		path.append((1, 'D'))
	tot += path[-1][0] * len(path[-1][1])
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	while tot > k:
		tmp = path[-1][1]
		cur = path[-1][0] * len(tmp)
		path.pop()
		tot -= cur
		if tot >= k:
			continue
		cur = k - tot
		if cur // len(tmp) > 0:
			path.append((cur // len(tmp), tmp))
		tmp = tmp[:cur % len(tmp)]
		if len(tmp) > 0:
			path.append((1, tmp))
		tot = k
	print('YES')
	p2 = []
	for i in path:
		if i[0]:
			p2.append(i)
	print(len(p2))
	for (i, j) in p2:
		if i:
			print(i, j)


(n, m, k) = map(int, input().split())
if 4 * n * m - 2 * n - 2 * m < k:
	print('NO')
	exit()
tmp = []
for i in range(n):
	if i != n - 1:
		tmp.append([m - 1, 'RDU'])
		tmp.append([m - 1, 'L'])
		tmp.append([1, 'D'])
	else:
		tmp.append([m - 1, 'R'])
		tmp.append([m - 1, 'L'])
		tmp.append([n - 1, 'U'])
ans = []
for (cnt, s) in tmp:
	if cnt == 0:
		continue
	ss = len(s)
	if k >= cnt * ss:
		ans.append([cnt, s])
		k -= cnt * ss
	else:
		(i, j) = divmod(k, ss)
		if i:
			ans.append([i, s])
		if j:
			ans.append([1, s[:j]])
		k = 0
	if k == 0:
		break
print('YES')
print(len(ans))
for i in ans:
	print(*i)


import array
import bisect
import collections
import fractions
import heapq
import itertools
import math
import re
import string
import sys

class joshu:

	@staticmethod
	def getInt():
		return int(input().strip())

	@staticmethod
	def getInts():
		return [int(i) for i in input().strip().split()]

	@staticmethod
	def getFloat():
		return float(input().strip())

	@staticmethod
	def getFloats():
		return [float(i) for i in input().strip().split()]

	@staticmethod
	def getStr():
		return str(input().strip())

	@staticmethod
	def getStrs():
		return [str(i) for i in input().strip().split()]

class foo_t:

	def __init__(self, k):
		self.bar = []
		self.rem = k

	def append(self, op):
		if self.rem == 0 or op[0] == 0:
			return
		cst = len(op[1])
		wht = op[0] * cst
		if wht <= self.rem:
			self.bar.append(op)
			self.rem -= wht
		else:
			k = self.rem // cst
			if k > 0:
				self.bar.append((k, op[1]))
				self.rem -= k * cst
			if self.rem > 0:
				self.bar.append((1, op[1][:self.rem]))
				self.rem = 0

def solution(n, m, k):
	if k > 4 * n * m - 2 * n - 2 * m:
		sys.stdout.write('NO\n')
		return
	foo = foo_t(k)
	foo.append((m - 1, 'R'))
	foo.append((m - 1, 'L'))
	for i in range(1, n):
		foo.append((1, 'D'))
		foo.append((m - 1, 'RUD'))
		foo.append((m - 1, 'L'))
	foo.append((n - 1, 'U'))
	sys.stdout.write('YES\n')
	sys.stdout.write('%d\n' % len(foo.bar))
	for row in foo.bar:
		sys.stdout.write('%d %s\n' % row)

def main():
	while True:
		try:
			(n, m, k) = joshu.getInts()
			solution(n, m, k)
		except ValueError:
			continue
		except EOFError:
			break
main()


import sys
(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	sys.exit()
print('YES')
comp = [(m - 1, 'R'), (m - 1, 'L')]
comp += (n - 1) * [(1, 'D'), (m - 1, 'R'), (m - 1, 'UDL')] + [(n - 1, 'U')]
ans = []
for x in comp:
	if x[0] == 0:
		continue
	if k <= 0:
		break
	if x[0] * len(x[1]) <= k:
		ans.append(x)
		k -= x[0] * len(x[1])
	else:
		cycles = k // len(x[1])
		if cycles:
			ans.append((cycles, x[1]))
		if k % len(x[1]):
			ans.append((1, x[1][:k % len(x[1])]))
		k = 0
print(len(ans))
for i in ans:
	print(i[0], i[1])


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(1):
	try:
		(n, m, k) = read()
		ans = []
		if k > 4 * n * m - 2 * n - 2 * m:
			print(NO)
			go()
		for i in range(n):
			if i % 2 == 0:
				ans.append([m - 1, 'R'])
			else:
				ans.append([m - 1, 'L'])
			if i != n - 1:
				ans.append([1, 'D'])
		if n % 2 == 0:
			for i in range(n - 1):
				if i % 2 == 0:
					ans.append([m - 1, 'UDR'])
					ans.append([1, 'U'])
				else:
					ans.append([m - 1, 'UDL'])
					ans.append([1, 'U'])
		else:
			for i in range(n - 1):
				if i % 2 == 1:
					ans.append([m - 1, 'UDR'])
					ans.append([1, 'U'])
				else:
					ans.append([m - 1, 'UDL'])
					ans.append([1, 'U'])
		ans.append([m - 1, 'L'])
		cur = 0
		real_ans = []
		for (i, j) in ans:
			if cur + i * len(j) <= k:
				if i != 0:
					real_ans.append([i, j])
				cur += i * len(j)
			else:
				remain = k - cur
				x = remain // len(j)
				if x > 0:
					real_ans.append([x, j])
				remain -= x * len(j)
				if remain > 0:
					real_ans.append([1, j[:remain]])
				break
		print(YES)
		print(len(real_ans))
		for (i, j) in real_ans:
			print(i, j)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


(n, m, k) = map(int, input().split())
A = []
for i in range(n - 1):
	if m > 1:
		A.append([m - 1, 'R'])
		A.append([m - 1, 'DUL'])
	A.append([1, 'D'])
if m > 1:
	A.append([m - 1, 'R'])
	A.append([m - 1, 'L'])
if n > 1:
	A.append([n - 1, 'U'])
s = 0
for i in range(len(A)):
	s += A[i][0] * len(A[i][1])
ANS = []
if s < k:
	print('NO')
else:
	print('YES')
	i = 0
	while k - A[i][0] * len(A[i][1]) > 0:
		ANS.append([A[i][0], A[i][1]])
		k -= A[i][0] * len(A[i][1])
		i += 1
	f = len(A[i][1])
	a = k // f
	b = k % f
	if a > 0:
		ANS.append([a, A[i][1]])
	if b > 0:
		ANS.append([1, A[i][1][:b]])
	print(len(ANS))
	for i in range(len(ANS)):
		print(ANS[i][0], ANS[i][1])


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
BUFSIZE = 8192

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def binarySearch(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def binarySearch(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
t = 1
for _ in range(t):
	(n, m, k) = map(int, input().split())
	ans = []
	(f, s) = (m - 1, 'R')
	c = min(f, k)
	if c == f and c:
		ans.append([f, s])
		k -= c
	elif c:
		ans.append([c, s])
		k -= c
		if k:
			ans.append([1, s[:k]])
		k = 0
	(f, s) = (m - 1, 'L')
	c = min(f, k)
	if c == f and c:
		ans.append([f, s])
		k -= c
	elif c:
		ans.append([c, s])
		k -= c
		if k:
			ans.append([1, s[:k]])
		k = 0
	for i in range(1, n):
		if k:
			ans.append([1, 'D'])
			k -= 1
		if k and m - 1:
			(f, s) = (m - 1, 'R')
			c = min(f, k)
			if c == f and c:
				ans.append([f, s])
				k -= c
			elif c:
				ans.append([c, s])
				k -= c
				if k:
					ans.append([1, s[:k]])
				k = 0
		if k and m - 1:
			(f, s) = (m - 1, 'UDL')
			c = min(f, k // 3)
			if c == f and c:
				ans.append([f, s])
				k -= c * 3
			else:
				if c:
					ans.append([c, s])
					k -= c * 3
				if k:
					ans.append([1, s[:k]])
				k = 0
	(f, s) = (n - 1, 'U')
	c = min(f, k)
	if c == f and c:
		ans.append([f, s])
		k -= c
	elif c:
		ans.append([c, s])
		k -= c
		if k:
			ans.append([1, s[:k]])
		k = 0
	if k:
		print('NO')
	else:
		print('YES')
		print(len(ans))
		for i in ans:
			print(*i)


(N, M, K) = map(int, input().split())
X = []
for _ in range(N - 1):
	X.append((M - 1, 'R'))
	X.append((M - 1, 'L'))
	X.append((1, 'D'))
for _ in range(M - 1):
	X.append((1, 'R'))
	X.append((N - 1, 'U'))
	X.append((N - 1, 'D'))
X.append((M - 1, 'L'))
X.append((N - 1, 'U'))
if K > 4 * N * M - 2 * N - 2 * M:
	print('NO')
else:
	print('YES')
	ANS = []
	for x in X:
		if x[0] >= K:
			ANS.append((K, x[1]))
			break
		if x[0]:
			ANS.append((x[0], x[1]))
			K -= x[0]
	print(len(ANS))
	for ans in ANS:
		print(ans[0], ans[1])


import math
(n, m, k) = map(int, input().split())
N = ((n - 1) * m + (m - 1) * n) * 2
if N < k:
	print('NO')
else:
	print('YES')
	K = k
	global_count = N
	count = 0
	ans = []
	while k > 0:
		if global_count > n - 1 + (m - 1) * 2:
			if count < (m - 1) * 3:
				if count % 3 == 0:
					ans.append('R')
				elif count % 3 == 1:
					ans.append('D')
				else:
					ans.append('U')
				count += 1
			elif count < (m - 1) * 4:
				ans.append('L')
				count += 1
			else:
				ans.append('D')
				count = 0
		elif global_count > n - 1 + m - 1:
			ans.append('R')
		elif global_count > n - 1:
			ans.append('L')
		else:
			ans.append('U')
		global_count -= 1
		k -= 1
	id = 0
	count = 0
	A = []
	while K > 0:
		count += 1
		tmp = 1
		if K > 3:
			while ans[id:id + 3] == ans[id + 3 * tmp:id + 3 + 3 * tmp]:
				tmp += 1
			A.append((tmp, ''.join(ans[id:id + 3])))
		else:
			A.append((1, ''.join(ans[id:])))
		id += 3 * tmp
		K -= 3 * tmp
	print(len(A))
	for (x, y) in A:
		print(x, y)


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	print('YES')
	if m == 1:
		down = 0
		up = 0
		if k > 0:
			down = min(n - 1, k)
			k -= n - 1
		if k > 0:
			up = min(n - 1, k)
			k -= n - 1
		a = 0
		if down:
			a += 1
		if up:
			a += 1
		print(a)
		if down:
			print(down, 'D')
		if up:
			print(up, 'U')
	elif n == 1:
		right = 0
		left = 0
		if k > 0:
			right = min(m - 1, k)
			k -= m - 1
		if k > 0:
			left = min(m - 1, k)
			k -= m - 1
		a = 0
		if right:
			a += 1
		if left:
			a += 1
		print(a)
		if right:
			print(right, 'R')
		if left:
			print(left, 'L')
	elif k <= m - 1:
		print(1)
		print(k, 'R')
	elif k <= m - 1 + ((n - 1) * 2 + 1) * (m - 1):
		k -= m - 1
		rep = k // ((n - 1) * 2 + 1)
		k %= (n - 1) * 2 + 1
		down = 0
		up = 0
		if k > 0:
			down = min(n - 1, k)
			k -= n - 1
		if k > 0:
			up = min(n - 1, k)
			k -= n - 1
		a = 1 + rep * 3
		if down:
			a += 1
		if up:
			a += 1
		print(a)
		print(m - 1, 'R')
		for _ in range(rep):
			print(n - 1, 'D')
			print(n - 1, 'U')
			print(1, 'L')
		if down:
			print(down, 'D')
		if up:
			print(up, 'U')
	elif k <= m - 1 + ((n - 1) * 2 + 1) * (m - 1) + (n - 1):
		k -= m - 1
		rep = m - 1
		k -= ((n - 1) * 2 + 1) * rep
		a = 1 + rep * 3 + 1
		print(a)
		print(m - 1, 'R')
		for _ in range(rep):
			print(n - 1, 'D')
			print(n - 1, 'U')
			print(1, 'L')
		print(k, 'D')
	else:
		k -= m - 1
		rep = m - 1
		k -= ((n - 1) * 2 + 1) * rep
		k -= n - 1
		rep2 = k // ((m - 1) * 2 + 1)
		k %= (m - 1) * 2 + 1
		right = 0
		left = 0
		if k > 0:
			right = min(m - 1, k)
			k -= m - 1
		if k > 0:
			left = min(m - 1, k)
			k -= m - 1
		a = 1 + rep * 3 + 1 + rep2 * 3
		if right:
			a += 1
		if left:
			a += 1
		print(a)
		print(m - 1, 'R')
		for _ in range(rep):
			print(n - 1, 'D')
			print(n - 1, 'U')
			print(1, 'L')
		print(n - 1, 'D')
		for _ in range(rep2):
			print(m - 1, 'R')
			print(m - 1, 'L')
			print(1, 'U')
		if right:
			print(right, 'R')
		if left:
			print(left, 'L')


import sys

def f():
	print(len(ans))
	for item in ans:
		print(item)
	sys.exit(0)
(n, m, k) = map(int, input().split())
if 4 * n * m - 2 * n - 2 * m >= k:
	print('YES')
	ans = []
	cnt = 0
	for i in range((m - 1) // 2):
		if k - cnt > (n - 1) * 3:
			if n > 1:
				ans.append(f'{n - 1} RLD')
			cnt += (n - 1) * 3
		else:
			if (k - cnt) // 3 > 0:
				ans.append(f'{(k - cnt) // 3} RLD')
			cnt += (k - cnt) // 3 * 3
			if k - cnt == 0:
				f()
			if k - cnt == 1:
				ans.append('1 R')
				f()
			if k - cnt == 2:
				ans.append('1 RL')
				f()
		if k - cnt > 0:
			ans.append('1 R')
			cnt += 1
		else:
			f()
		if k - cnt > (n - 1) * 3:
			if n > 1:
				ans.append(f'{n - 1} RLU')
			cnt += (n - 1) * 3
		else:
			if (k - cnt) // 3 > 0:
				ans.append(f'{(k - cnt) // 3} RLU')
			cnt += (k - cnt) // 3 * 3
			if k - cnt == 0:
				f()
			if k - cnt == 1:
				ans.append('1 R')
				f()
			if k - cnt == 2:
				ans.append('1 RL')
				f()
		if k - cnt > 0:
			ans.append('1 R')
			cnt += 1
		else:
			f()
	if m % 2 == 0:
		if k - cnt > (n - 1) * 3:
			if n > 1:
				ans.append(f'{n - 1} RLD')
			cnt += (n - 1) * 3
		else:
			if (k - cnt) // 3 > 0:
				ans.append(f'{(k - cnt) // 3} RLD')
			cnt += (k - cnt) // 3 * 3
			if k - cnt == 0:
				f()
			if k - cnt == 1:
				ans.append('1 R')
				f()
			if k - cnt == 2:
				ans.append('1 RL')
				f()
		if k - cnt > 0:
			ans.append('1 R')
			cnt += 1
		else:
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} U')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} U')
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} D')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} D')
			f()
		if k - cnt > 0:
			ans.append('1 L')
			cnt += 1
		else:
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} U')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} U')
			f()
	else:
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} D')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} D')
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} U')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} U')
			f()
	for i in range((m - 1) // 2):
		if k - cnt > 0:
			ans.append('1 L')
			cnt += 1
		else:
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} D')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} D')
			f()
		if k - cnt > 0:
			ans.append('1 L')
			cnt += 1
		else:
			f()
		if k - cnt > n - 1:
			if n > 1:
				ans.append(f'{n - 1} U')
			cnt += n - 1
		else:
			if k - cnt > 0:
				ans.append(f'{k - cnt} U')
			f()
else:
	print('NO')


import os, sys
from io import BytesIO, IOBase

def main():
	(n, m, k) = map(int, input().split())
	if k > 4 * n * m - 2 * m - 2 * n:
		print('NO')
		exit()
	print('YES')
	if n == 1:
		step = [(m - 1, 'R'), (m - 1, 'L')]
	elif m == 1:
		step = [(n - 1, 'D'), (n - 1, 'U')]
	else:
		(v, v1) = ([(n - 1, 'RLD'), (n - 1, 'RLU')], (1, 'R'))
		step = [(n - 1, 'RLD')]
		for i in range(m - 1):
			step.append(v1)
			if i != m - 2:
				step.append(v[not i % 2])
			else:
				z = list(v[not i % 2])
				z[1] = z[1][2:]
				step.append(tuple(z))
		if m & 1:
			step.append((n - 1, 'U'))
		else:
			step.append((n - 1, 'D'))
		(v, v1) = ([(n - 1, 'D'), (n - 1, 'U')], (1, 'L'))
		for i in range(m - 1):
			step.append(v1)
			step.append(v[(m - i - 1) % 2])
	fin = []
	ans = 0
	for i in step:
		ans += len(i[1]) * i[0]
		if ans > k:
			ans -= len(i[1]) * i[0]
			if k - ans >= len(i[1]):
				fin.append(((k - ans) // len(i[1]), i[1]))
			z = (k - ans) % len(i[1])
			if z:
				fin.append((1, i[1][:z]))
			break
		fin.append(i)
	print(len(fin))
	for i in fin:
		print(*i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
(n, m, k) = list(map(int, input().split()))
ans = []
cnt = 0
if m - 1 != 0:
	if k == 0:
		pass
	elif k > m - 1:
		ans.append((m - 1, 'R'))
		cnt += 1
		k -= m - 1
	else:
		ans.append((k, 'R'))
		cnt += 1
		k = 0
	if k == 0:
		pass
	elif k > m - 1:
		ans.append((m - 1, 'L'))
		cnt += 1
		k -= m - 1
	else:
		ans.append((k, 'L'))
		cnt += 1
		k = 0
for i in range(n - 1):
	if k == 0:
		pass
	elif k > 1:
		ans.append((1, 'D'))
		cnt += 1
		k -= 1
	else:
		ans.append((1, 'D'))
		cnt += 1
		k = 0
	if m - 1 != 0:
		if k == 0:
			pass
		elif k > (m - 1) * 3:
			ans.append((m - 1, 'RUD'))
			cnt += 1
			k -= (m - 1) * 3
		else:
			times = k // 3
			nokori = k % 3
			if times != 0:
				ans.append((times, 'RUD'))
				cnt += 1
			if nokori != 0:
				ans.append((1, 'RUD'[0:nokori]))
				cnt += 1
			k = 0
		if k == 0:
			pass
		elif k > m - 1:
			ans.append((m - 1, 'L'))
			cnt += 1
			k -= m - 1
		else:
			ans.append((k, 'L'))
			cnt += 1
			k = 0
if k == 0:
	pass
elif k > n - 1:
	ans.append((n - 1, 'U'))
	cnt += 1
	k -= n - 1
else:
	ans.append((k, 'U'))
	cnt += 1
	k = 0
if k == 0:
	print('YES')
	print(cnt)
	for i in ans:
		print(*i)
else:
	print('NO')


(n, m, k) = list(map(int, input().split()))

def alt(n, m, k, pat, buff):
	if k == 0:
		return 0
	l = (m - 1) * 3
	if l <= k:
		buff.append((m - 1, pat))
		k = k - l
	else:
		if k // 3 > 0:
			buff.append((k // 3, pat))
		k = k % 3
		if k == 1:
			buff.append((1, pat[:1]))
		elif k == 2:
			buff.append((1, pat[:2]))
		k = 0
	return k

def state1(n, m, k, first, second, buff):
	if k == 0:
		return 0
	if k >= m - 1:
		buff.append((m - 1, first))
		k -= m - 1
	else:
		buff.append((k, first))
		return 0
	if k == 0:
		return 0
	if k >= m - 1:
		buff.append((m - 1, second))
		k -= m - 1
	else:
		buff.append((k, second))
		return 0
	return k

def state2(n, m, k, direction, buff):
	if k == 0:
		return 0
	if k >= m - 1:
		buff.append((m - 1, direction))
		k -= m - 1
	else:
		buff.append((k, direction))
		return 0
	return k
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	buff = []
	print('YES')
	if n == 1:
		buff.append((min(k, m - 1), 'R'))
		k -= m - 1
		if k > 0:
			buff.append((k, 'L'))
	elif m == 1:
		buff.append((min(k, n - 1), 'D'))
		k -= n - 1
		if k > 0:
			buff.append((k, 'U'))
	else:
		state = 0
		y = 0
		while k > 0:
			if state == 0:
				if y == n - 1:
					state = 1
					continue
				if y % 2 == 0:
					k = alt(n, m, k, 'DUR', buff)
				else:
					k = alt(n, m, k, 'DUL', buff)
				if k > 0:
					buff.append((1, 'D'))
					k -= 1
				y += 1
			elif state == 1:
				if y % 2 == 0:
					k = state1(n, m, k, 'R', 'L', buff)
				else:
					k = state1(n, m, k, 'L', 'R', buff)
				state = 2
			elif state == 2:
				buff.append((1, 'U'))
				k -= 1
				if y % 2 == 0:
					k = state2(n, m, k, 'R', buff)
				else:
					k = state2(n, m, k, 'L', buff)
				y -= 1
	print(len(buff))
	for x in buff:
		print(x[0], x[1])


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
(n, m, k) = map(int, input().split())

def route(n, m, k):
	limit = 4 * n * m - 2 * n - 2 * m
	if k > limit:
		return None
	if m == 1:
		if k > n - 1:
			ans = [(n - 1, 'D'), (k - (n - 1), 'U')]
		else:
			ans = [(k, 'D')]
		return ans
	fullR = (m - 1, 'R')
	fullL = (m - 1, 'L')
	D = (1, 'D')
	G = 'RUD'
	ans = []
	if k > m - 1:
		ans.append(fullR)
		k -= m - 1
	else:
		ans.append((k, 'R'))
		return ans
	if k > m - 1:
		ans.append(fullL)
		k -= m - 1
	else:
		ans.append((k, 'L'))
		return ans
	r = 1
	while k > 0 and r < n:
		ans.append(D)
		r += 1
		k -= 1
		t = 0
		while k >= 3 and t < m - 1:
			t += 1
			k -= 3
		if t > 0:
			ans.append((t, G))
		if k == 0:
			break
		if t == m - 1:
			if k > m - 1:
				ans.append(fullL)
				k -= m - 1
			else:
				ans.append((k, 'L'))
				k = 0
				break
		else:
			ans.append((1, G[:k]))
			k = 0
			break
	if k > 0:
		ans.append((k, 'U'))
	return ans
ans = route(n, m, k)
if ans is None:
	print('NO')
else:
	print('YES')
	print(len(ans))
	for (t, s) in ans:
		sys.stdout.write(f'{t} {s}\n')


def solve(N, M, K):
	ans = []
	MAX = 4 * N * M - 2 * N - 2 * M
	if K > MAX:
		return 'NO'
	if N == 1 or M == 1:
		if N == 1:
			x = K // 2
			ans.append(str(K - x) + ' R')
			ans.append(str(x) + ' L')
		elif M == 1:
			x = K // 2
			ans.append(str(K - x) + ' D')
			ans.append(str(x) + ' U')
		K = 0
	else:
		for i in range(N - 1):
			if K >= 4 * (M - 1) + 1:
				ans.append(str(M - 1) + ' R')
				ans.append('1 D')
				ans.append(str(M - 1) + ' ULD')
				K -= M - 1 + 1 + 3 * (M - 1)
			else:
				assert K < 4 * (M - 1) + 1
				if K > 0:
					ans.append(str(min(K, M - 1)) + ' R')
					K -= min(K, M - 1)
				assert K < 3 * (M - 1) + 1
				if K > 0:
					ans.append('1 D')
					K -= 1
				assert K < 3 * (M - 1)
				if K >= 3:
					times = K // 3
					assert times < M - 1
					ans.append(str(times) + ' ULD')
					K -= 3 * times
				assert K < 3
				if K == 1:
					ans.append('1 U')
					K -= 1
				elif K == 2:
					ans.append('1 UL')
					K -= 2
				else:
					assert K == 0
				assert K == 0
		if K > 0:
			ans.append(str(min(K, M - 1)) + ' R')
			K -= min(K, M - 1)
		if K > 0:
			ans.append(str(min(K, M - 1)) + ' L')
			K -= min(K, M - 1)
		if K > 0:
			ans.append(str(min(K, N - 1)) + ' U')
			K -= min(K, N - 1)
		assert K == 0
	a = len(ans)
	assert a <= 3000
	return 'YES\n' + str(a) + '\n' + '\n'.join(ans)
(N, M, K) = map(int, input().split())
ans = solve(N, M, K)
print(ans)


(n, m, k) = map(int, input().split())
turns = []

def myflush():
	print(len(turns))
	print(*[' '.join(map(str, turn)) for turn in turns], sep='\n')
	exit()
if m == 1:
	if k > 2 * n - 2:
		print('NO')
		exit()
	print('YES')
	if k > n - 1:
		turns.append((n - 1, 'D'))
		k -= n - 1
		turns.append((k, 'U'))
	else:
		turns.append((k, 'D'))
	myflush()
elif n == 1:
	if k > 2 * m - 2:
		print('NO')
		exit()
	print('YES')
	if k > m - 1:
		turns.append((m - 1, 'R'))
		k -= m - 1
		turns.append((k, 'L'))
	else:
		print(k, 'L')
	myflush()
else:
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
		exit()
	print('YES')
	if k <= m - 1:
		turns.append((k, 'R'))
		myflush()
	turns.append((m - 1, 'R'))
	k -= m - 1
	for i in range(1, n):
		turns.append((1, 'D'))
		k -= 1
		if k == 0:
			myflush()
		if k <= 3 * (m - 1):
			if k >= 3:
				turns.append((k // 3, 'LUD'))
			if k % 3 > 0:
				turns.append((1, 'L'))
			if k % 3 > 1:
				turns.append((1, 'U'))
			myflush()
		turns.append((m - 1, 'LUD'))
		k -= 3 * (m - 1)
		if k <= m - 1:
			turns.append((k, 'R'))
			myflush()
		turns.append((m - 1, 'R'))
		k -= m - 1
	if k <= n - 1:
		turns.append((k, 'U'))
		myflush()
	turns.append((n - 1, 'U'))
	k -= n - 1
	turns.append((k, 'L'))
	myflush()


def print_sol():
	print(len(steps))
	for (i, s) in steps:
		print(i, s)
(n, m, k) = map(int, input().split())
if 4 * m * n - 2 * m - 2 * n < k:
	print('NO')
	exit()
print('YES')
steps = []
if m == 1:
	if k <= n - 1:
		steps.append((k, 'D'))
		print_sol()
		exit()
	steps.append((n - 1, 'D'))
	k -= n - 1
	steps.append((k, 'U'))
	print_sol()
	exit()
if k <= m - 1:
	steps.append((k, 'R'))
	print_sol()
	exit()
steps.append((m - 1, 'R'))
k -= m - 1
if k <= m - 1:
	steps.append((k, 'L'))
	print_sol()
	exit()
steps.append((m - 1, 'L'))
k -= m - 1
for i in range(n - 1):
	steps.append((1, 'D'))
	k -= 1
	if k == 0:
		print_sol()
		exit()
	if k <= 3 * (m - 1):
		if k >= 3:
			steps.append((k // 3, 'RUD'))
		k %= 3
		if k == 1:
			steps.append((1, 'R'))
		elif k == 2:
			steps.append((1, 'RU'))
		print_sol()
		exit()
	steps.append((m - 1, 'RUD'))
	k -= 3 * (m - 1)
	if k <= m - 1:
		steps.append((k, 'L'))
		print_sol()
		exit()
	steps.append((m - 1, 'L'))
	k -= m - 1
steps.append((k, 'U'))
print_sol()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

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

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

def main():
	(n, m, k) = map(int, input().split())
	(n, m) = (m, n)
	ans = []
	f = 0
	for i in range(m - 1):
		if k:
			t = min(k, n - 1)
			k -= t
			if t:
				ans.append([t, 'R'])
			if k:
				t = min(k, n - 1)
				k -= t
				if t:
					ans.append([t, 'L'])
				if k:
					ans.append([1, 'D'])
					k -= 1
	for i in range(n - 1):
		if k:
			k -= 1
			ans.append([1, 'R'])
			if k:
				t = min(k, m - 1)
				k -= t
				if t:
					ans.append([t, 'U'])
				if k:
					t = min(k, m - 1)
					k -= t
					if t:
						ans.append([t, 'D'])
	if k:
		t = min(k, n - 1)
		if t:
			ans.append([t, 'L'])
		k -= t
		if k:
			t = min(k, m - 1)
			if t:
				ans.append([t, 'U'])
			k -= t
	if k or len(ans) > 3000:
		print('NO')
	else:
		print('YES')
		print(len(ans))
		for i in ans:
			print(*i)
	return
main()


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nl():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def func(n, m, k):
	if 4 * m * n - 2 * n - 2 * m < k:
		return True
	else:
		return False

def solve():
	(n, m, k) = sep()
	if func(n, m, k):
		print('NO')
	else:
		print('YES')
		ans = []
		if m - 1 > 0:
			ans.append([m - 1, 'R'])
		for i in range(m - 1):
			if n - 1 > 0:
				ans.append([n - 1, 'DLR'])
			temp = n - 1
			a = temp // 4
			if a > 0:
				ans.append([a, 'UUUU'])
			temp = temp - 4 * a
			if temp > 0:
				ans.append([1, 'U' * temp + 'L'])
			else:
				ans.append([1, 'L'])
		temp = n - 1
		a = temp // 4
		if a > 0:
			ans.append([a, 'DDDD'])
		temp = temp - 4 * a
		if temp > 0:
			ans.append([1, 'D' * temp])
		temp = n - 1
		a = temp // 4
		if a > 0:
			ans.append([a, 'UUUU'])
		temp = temp - 4 * a
		if temp > 0:
			ans.append([1, 'U' * temp])
		ans.append([n - 1, 'U' * (n - 1)])
		finall = []
		cnt = 0
		index = 0
		while True:
			if cnt + len(ans[index][1]) * ans[index][0] == k:
				finall.append(ans[index])
				break
			if cnt + len(ans[index][1]) * ans[index][0] < k:
				finall.append(ans[index])
				cnt += len(ans[index][1]) * ans[index][0]
				index += 1
			else:
				rem = k - cnt
				if ans[index][0] == 1:
					finall.append([1, ans[index][1][:rem]])
					break
				else:
					b = rem // len(ans[index][1])
					if b > 0:
						finall.append([b, ans[index][1]])
					rem = rem - len(ans[index][1]) * b
					if rem > 0:
						finall.append([1, ans[index][1][:rem]])
					break
		print(len(finall))
		for i in range(0, len(finall)):
			print(finall[i][0], finall[i][1])
testcase(1)


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

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

def main():
	(n, m, k) = lin()
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
	else:
		a = []
		for i in range(n - 1):
			if k == 0:
				break
			if k <= 4 * (m - 1) and m - 1:
				if k <= 3 * (m - 1):
					x = k // 3
					x1 = k % 3
					if x:
						a.append([x, 'RDU'])
					if x1:
						a.append([1, 'RDU'[:x1]])
				else:
					a.append([m - 1, 'RDU'])
					k -= 3 * (m - 1)
					a.append([k, 'L'])
				k = 0
			else:
				if m - 1:
					a.append([m - 1, 'RDU'])
					a.append([m - 1, 'L'])
				a.append([1, 'D'])
				k = k - 4 * (m - 1) - 1
		else:
			if k and m - 1:
				if k < 2 * m - 2:
					if k <= m - 1:
						a.append([k, 'R'])
					else:
						k -= m - 1
						a.append([m - 1, 'R'])
						a.append([k, 'L'])
					k = 0
				else:
					a.append([m - 1, 'R'])
					a.append([m - 1, 'L'])
					k -= 2 * m - 2
		if k:
			a.append([k, 'U'])
		print('YES')
		print(len(a))
		for (i, j) in a:
			print(i, j)
main()


(n, m, k) = [int(x) for x in input().split()]
steps = []

def run(direction, amount):
	global k
	x = min(amount, k)
	k -= x
	if x > 0:
		steps.append((x, direction))
if k > 4 * m * n - 2 * m - 2 * n:
	print('NO')
	exit(0)
run('D', n - 1)
for i in range(n - 1):
	run('R', m - 1)
	run('L', m - 1)
	run('U', 1)
run('R', m - 1)
for i in range(m - 1):
	run('D', n - 1)
	run('U', n - 1)
	run('L', 1)
print('YES')
print(len(steps))
for s in steps:
	print(*s)


import sys
local = len(sys.argv) > 1 and sys.argv[1] == 'local'
handler = open('input') if local else None

def inp():
	if local:
		return handler.readline()
	else:
		return input()
(n, m, k) = map(int, inp().split())
commands = []

def sp(c, n):
	v = [c * 4 for i in range(n // 4)]
	if n % 4 > 0:
		v += [c * (n % 4)]
	return v
if n == 1:
	commands += sp('R', m - 1)
	commands += sp('L', m - 1)
elif m == 1:
	commands += sp('D', n - 1)
	commands += sp('U', n - 1)
else:
	for i in range(m - 1):
		commands += ['RDL' for i in range(n - 1)]
		commands += ['R']
		commands += sp('U', n - 1)
	commands += sp('L', m - 1)
	commands += sp('D', n - 1)
	commands += sp('U', n - 1)
N = 4 * m * n - 2 * m - 2 * n
if k > N:
	print('NO')
	exit()
s = 0
M = len(commands)
for i in range(len(commands)):
	if s + len(commands[i]) == k:
		commands = commands[:i + 1]
		break
	elif s + len(commands[i]) > k:
		commands[i] = commands[i][:k - s]
		commands = commands[:i + 1]
		break
	else:
		s += len(commands[i])
a = [[1, commands[0]]]
for i in range(1, len(commands)):
	if commands[i] == a[-1][1]:
		a[-1][0] += 1
	else:
		a.append([1, commands[i]])
print('YES')
print(len(a))
for (x, y) in a:
	print(x, y)


(n, m, k) = map(int, input().split())
max_k = 4 * n * m - 2 * n - 2 * m
if k > max_k:
	print('NO')
	exit()
print('YES')
c = []
if m > 1:
	c += [(m - 1, 'R'), (m - 1, 'L')]
for _ in range(n - 1):
	c += [(1, 'D')]
	if m > 1:
		c += [(m - 1, 'RUD'), (m - 1, 'L')]
if n > 1:
	c += [(n - 1, 'U')]
a = []
steps = 0
for (count, coms) in c:
	if steps >= k:
		break
	fitting_count = (k - steps) // len(coms)
	if fitting_count >= count:
		a += [(count, coms)]
		steps += count * len(coms)
	else:
		if fitting_count > 0:
			a += [(fitting_count, coms)]
			steps += fitting_count * len(coms)
		rem = k - steps
		if rem > 0:
			a += [(1, coms[:rem])]
			steps += rem
print(len(a))
for (count, coms) in a:
	print(count, coms)


import io, os
import sys
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, m, k) = map(int, input().split())
phase = 0
times = 0
if k > 4 * n * m - 2 * m - 2 * n:
	print('NO')
else:
	print('YES')
	output = []
	if n > 1:
		while k and times < m - 1:
			if phase == 0:
				if k >= (n - 1) * 3:
					output.append((n - 1, 'DRL'))
					k -= 3 * (n - 1)
				else:
					if k // 3:
						output.append((k // 3, 'DRL'))
					if k % 3:
						output.append((1, 'DRL'[:k % 3]))
					k = 0
			elif phase == 1:
				if k >= n - 1:
					output.append((n - 1, 'U'))
					k -= n - 1
				else:
					output.append((k, 'U'))
					k = 0
			elif phase == 2:
				output.append((1, 'R'))
				k -= 1
				times += 1
			phase += 1
			phase = phase % 3
		if k:
			output.append((min(k, n - 1), 'D'))
			k -= min(k, n - 1)
		if k:
			output.append((min(k, n - 1), 'U'))
			k -= min(k, n - 1)
	else:
		output.append((min(m - 1, k), 'R'))
		k -= min(m - 1, k)
	if k:
		output.append((k, 'L'))
	print(len(output))
	for zz in output:
		print(*zz)


import sys
(n, m, k) = tuple(map(int, input().split()))
if n == 1:
	if k > 2 * (m - 1):
		print('NO')
	else:
		print('YES')
		if k <= m - 1:
			print(1)
			print(k, 'R')
		else:
			print(2)
			print(m - 1, 'R')
			print(k - (m - 1), 'L')
	sys.exit()
elif m == 1:
	if k > 2 * (n - 1):
		print('NO')
	else:
		print('YES')
		if k <= n - 1:
			print(1)
			print(k, 'D')
		else:
			print(2)
			print(n - 1, 'D')
			print(k - (n - 1), 'U')
	sys.exit()
path = [(m - 1, 0), (n - 1, 1)]
path += [(1, 2), (n - 1, 3), (n - 1, 1)] * (m - 2)
path += [(1, 2), (m - 1, 0), (n - 1, 3), (m - 1, 2)]
path += [(1, 1), (m - 1, 0), (m - 1, 2)] * (n - 2)
path += [(1, 1), (n - 1, 3)]
summax = sum([i[0] for i in path])
if k > summax:
	print('NO')
	sys.exit()
todel = summax - k
while todel > 0 and path[-1][0] <= todel:
	todel -= path.pop()[0]
path[-1] = (path[-1][0] - todel, path[-1][1])
print('YES')
print(len(path))
letters = ['R', 'D', 'L', 'U']
for i in path:
	print(i[0], letters[i[1]])


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
(n, m, k) = read()
maxx = 4 * n * m - 2 * n - 2 * m
if k > maxx:
	print('NO')
else:
	i = 0
	ans = []
	while i <= n - 1:
		if i == n - 1:
			if m - 1 <= k and m - 1 > 0:
				ans.append((m - 1, 'R'))
				k -= m - 1
				if k == 0:
					break
			elif m - 1 > k:
				ans.append((k, 'R'))
				k -= k
				break
			if m - 1 <= k and m - 1 > 0:
				ans.append((m - 1, 'L'))
				k -= m - 1
				if k == 0:
					break
			elif m - 1 > k:
				ans.append((k, 'L'))
				k -= k
				break
			break
		if m - 1 <= k and m - 1 > 0:
			ans.append((m - 1, 'R'))
			k -= m - 1
			if k == 0:
				break
		elif m - 1 > k:
			ans.append((k, 'R'))
			k -= k
			break
		if 3 * (m - 1) <= k and m - 1 > 0:
			ans.append((m - 1, 'DUL'))
			k -= 3 * (m - 1)
			if k == 0:
				break
		elif 3 * (m - 1) > k:
			if k >= 3:
				ans.append((k // 3, 'DUL'))
				k -= k // 3 * 3
			if k == 2:
				ans.append((1, 'DU'))
				k -= 2
			if k == 1:
				ans.append((1, 'D'))
				k -= 1
			break
		if k > 0:
			ans.append((1, 'D'))
			k -= 1
			i += 1
		if k == 0:
			break
	if k > 0:
		ans.append((k, 'U'))
	print('YES')
	print(len(ans))
	for tup in ans:
		print(tup[0], tup[1])


import sys
import math
from collections import defaultdict, Counter
(n, m, k) = map(int, input().split())
if k > 4 * m * n - 2 * n - 2 * m:
	print('NO')
else:
	k1 = k
	print('YES')
	s = ''
	c = 0
	if m >= n:
		flag = 0
		d = min(k, m - 1)
		if d != 0:
			s += str(d) + ' R' + '\n'
			k -= d
			c += 1
		while k:
			if c == 2 * n + n - 1:
				c += 1
				s += str(k) + ' U\n'
				break
			if flag % 3 == 0:
				d = min(k, m - 1)
				s += str(d) + ' L' + '\n'
				k -= d
				flag += 1
			elif flag % 3 == 1:
				s += '1 D\n'
				flag += 1
				k -= 1
			else:
				d = min(k, (m - 1) * 3)
				if d == 3 * (m - 1):
					s += str(m - 1) + ' RUD' + '\n'
				else:
					if k >= 3:
						s += str(k // 3) + ' RUD' + '\n'
					else:
						c -= 1
					if d % 3 == 1:
						s += '1 R\n'
						c += 1
					elif d % 3 == 2:
						s += '1 RU\n'
						c += 1
				k -= d
				flag += 1
			c += 1
	else:
		flag = 0
		d = min(k, n - 1)
		if d != 0:
			s += str(d) + ' D' + '\n'
			k -= d
			c += 1
		while k:
			if c == 2 * m + m - 1:
				c += 1
				s += str(k) + ' L\n'
				break
			if flag % 3 == 0:
				d = min(k, n - 1)
				s += str(d) + ' U' + '\n'
				k -= d
				flag += 1
			elif flag % 3 == 1:
				s += '1 R\n'
				flag += 1
				k -= 1
			else:
				d = min(k, (n - 1) * 3)
				if d == 3 * (n - 1):
					s += str(n - 1) + ' DLR' + '\n'
				else:
					if k >= 3:
						s += str(k // 3) + ' DLR' + '\n'
					else:
						c -= 1
					if d % 3 == 1:
						s += '1 D\n'
						c += 1
					elif d % 3 == 2:
						s += '1 DL\n'
						c += 1
				k -= d
				flag += 1
			c += 1
	print(c)
	print(s[:-1])


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, m, k) = map(int, input().split())
if k > 2 * (m * (n - 1) + n * (m - 1)):
	print('NO')
	sys.exit(0)
ans = []
cur = 0
t = 0
while t < m - 1:
	ans.append((1, 'R'))
	t += 1
	ans.append((n - 1, 'D'))
	ans.append((n - 1, 'U'))
t = 0
ans.append((m - 1, 'L'))
while t < n - 1:
	ans.append((1, 'D'))
	t += 1
	ans.append((m - 1, 'R'))
	ans.append((m - 1, 'L'))
ans.append((n - 1, 'U'))
fi = []
y = 0
while cur < k:
	(a, b) = ans[y]
	if a == 0:
		y += 1
		continue
	if a + cur <= k:
		fi.append(ans[y])
		cur = cur + a
	else:
		fi.append((k - cur, b))
		cur = k
	y += 1
print('YES')
print(len(fi))
for i in range(len(fi)):
	print(*fi[i])


import math
(n, m, k) = list(map(int, input().split()))
if k > 4 * n * m - 2 * m - 2 * n:
	print('NO')
else:
	print('YES')
	a = n - 1
	b = 3 * (n - 1) + 1 + (n - 1)
	c = m - 1
	d = n - 1
	farr = []
	if k <= a:
		farr.append([k, 'D'])
	elif k <= a + (m - 1) * b:
		farr.append([a, 'D'])
		val = math.ceil((k - a) / (4 * n - 3))
		if (k - a) % (4 * n - 3) == 0:
			for xx in range(val):
				farr.append([n - 1, 'RUL'])
				farr.append([1, 'R'])
				farr.append([n - 1, 'D'])
		else:
			for xx in range(val - 1):
				farr.append([n - 1, 'RUL'])
				farr.append([1, 'R'])
				farr.append([n - 1, 'D'])
		val = (k - a) % (4 * n - 3)
		if val <= 3 * (n - 1):
			idx = math.ceil(val / 3) - 1
			if val % 3 == 0:
				farr.append([idx + 1, 'RUL'])
			elif idx != 0:
				farr.append([idx, 'RUL'])
			val %= 3
			if val == 1:
				farr.append([1, 'R'])
			elif val == 2:
				farr.append([1, 'RU'])
		elif val == 3 * (n - 1) + 1:
			farr.append([n - 1, 'RUL'])
			farr.append([1, 'R'])
		else:
			farr.append([n - 1, 'RUL'])
			farr.append([1, 'R'])
			farr.append([val - 1 - 3 * (n - 1), 'D'])
	elif k <= a + (m - 1) * b + c:
		farr.append([a, 'D'])
		for xx in range(m - 1):
			farr.append([n - 1, 'RUL'])
			farr.append([1, 'R'])
			farr.append([n - 1, 'D'])
		farr.append([k - a - (m - 1) * b, 'L'])
	elif k <= a + (m - 1) * b + c + d:
		farr.append([a, 'D'])
		for xx in range(m - 1):
			farr.append([n - 1, 'RUL'])
			farr.append([1, 'R'])
			farr.append([n - 1, 'D'])
		farr.append([c, 'L'])
		farr.append([k - a - (m - 1) * b - c, 'U'])
	val = 0
	for x in farr:
		if x[0] != 0:
			val += 1
	print(val)
	for x in farr:
		if x[0] != 0:
			print(x[0], x[1])


(n, m, k) = map(int, input().split())
if 4 * n * m - 2 * n - 2 * m < k:
	print('NO')
	exit()
print('YES')
path = []
if n == 1:
	path.append((m - 1, 'R'))
	path.append((m - 1, 'L'))
elif m == 1:
	path.append((n - 1, 'D'))
	path.append((n - 1, 'U'))
else:
	for _ in range(m - 2):
		path.append((1, 'R'))
		path.append((n - 1, 'D'))
		path.append((n - 1, 'U'))
	path.append((1, 'R'))
	for _ in range(n - 2):
		path.append((1, 'D'))
		path.append((m - 1, 'L'))
		path.append((m - 1, 'R'))
	path.append((1, 'D'))
	path.append((m - 1, 'L'))
	path.append((n - 1, 'U'))
	path.append((n - 1, 'D'))
	path.append((m - 1, 'R'))
	path.append((n - 1, 'U'))
	path.append((m - 1, 'L'))
acc = 0
ans = []
for (v, s) in path:
	if acc + v < k:
		ans.append((v, s))
		acc += v
	else:
		ans.append((k - acc, s))
		break
print(len(ans))
for (v, s) in ans:
	print(v, s)


(n, m, k) = map(int, input().split(' '))
lis = []
lis.append(('R', m - 1))
lis.append(('L', m - 1))
for i in range(n - 1):
	lis.append(('D', 1))
	lis.append(('RUD', m - 1))
	lis.append(('L', m - 1))
lis.append(('U', n - 1))
iter = 0
res = []
while iter < len(lis) and k > 0:
	tup = lis[iter]
	iter += 1
	l = len(tup[0]) * tup[1]
	if l <= k:
		k -= l
		res.append(tup)
	else:
		ft = (tup[0], k // len(tup[0]))
		res.append(ft)
		st = (tup[0][0:k % len(tup[0])], 1)
		res.append(st)
		k = 0
		break
if k > 0:
	print('NO')
	exit(0)
res = list(filter(lambda x: x[1] > 0 and len(x[0]) > 0, res))
print('YES')
print(len(res))
for e in res:
	print(e[1], e[0])


(n, m, k) = map(int, input().split())
dr = {'D': 'U', 'U': 'D', 'R': 'L', 'L': 'R'}

def rev(c):
	return dr[c]

def norm(ans):
	return [[num, c] for (num, c) in ans if num != 0 and len(c) > 0]

def get_ans(full, n, m, k):
	if k > 4 * n * m - 2 * n - 2 * m:
		return ('NO', None)
	ans = []
	for (num, c) in full:
		if k == 0:
			break
		total = num * len(c)
		if k >= total:
			ans.append([num, c])
			k -= total
		else:
			ans.append([k // len(c), c])
			ans.append([1, c[:k % len(c)]])
			break
	ans = norm(ans)
	return ('YES', ans)
full = []
c = 'R'
for i in range(n):
	full.append([m - 1, c])
	if i != n - 1:
		full.append([1, 'D'])
	c = dr[c]
for i in range(n):
	if i != 0:
		full.append([m - 1, c + 'DU'])
	else:
		full.append([m - 1, c])
	if i != n - 1:
		full.append([1, 'U'])
	c = dr[c]
full = norm(full)
(flg, ans) = get_ans(full, n, m, k)
print(flg)
if flg == 'YES':
	print(len(ans))
	for (num, c) in ans:
		print(str(num) + ' ' + c)


(n, m, k) = map(int, input().split())
M = 4 * n * m - 2 * n - 2 * m
if k > M:
	print('NO')
else:
	print('YES')
	ans = []
	a = 0
	if k <= m - 1:
		ans.append([k, 'R'])
		a += 1
	else:
		if m - 1 != 0:
			ans.append([m - 1, 'R'])
			a += 1
			k -= m - 1
		if k <= m - 1:
			ans.append([k, 'L'])
			a += 1
		else:
			if m - 1 != 0:
				ans.append([m - 1, 'L'])
				a += 1
				k -= m - 1
			i = 1
			while k >= 4 * m - 3 and i <= n - 1:
				ans.append([1, 'D'])
				a += 1
				k -= 1
				if m - 1 != 0:
					ans.append([m - 1, 'RUD'])
					ans.append([m - 1, 'L'])
					a += 2
					k -= 4 * m - 4
				i += 1
			if i == n:
				if k != 0:
					ans.append([k, 'U'])
					a += 1
			else:
				if k > 0:
					ans.append([1, 'D'])
					k -= 1
					a += 1
				if 0 < k <= 3 * m - 3:
					if k // 3 != 0:
						ans.append([k // 3, 'RUD'])
						a += 1
					if k % 3 != 0:
						ans.append([1, 'RUD'[:k % 3]])
						a += 1
				if 3 * m - 3 < k:
					if m - 1 != 0:
						ans.append([m - 1, 'RUD'])
						a += 1
						k -= 3 * m - 3
					ans.append([k, 'L'])
					a += 1
	print(a)
	for ans_ in ans:
		print(*ans_)


import math, collections, sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
p = 4 * n * m - 2 * n - 2 * m
if k > p:
	print('NO')
	exit()
ans = []
for i in range(n - 1):
	if not k:
		break
	if k >= m - 1:
		ans.append([m - 1, 'R'])
		k -= m - 1
	elif k:
		ans.append([k, 'R'])
		k = 0
		break
	if k >= 3 * (m - 1):
		ans.append([m - 1, 'DUL'])
		k -= 3 * (m - 1)
	elif k:
		if k > 3:
			ans.append([k // 3, 'DUL'])
			k -= k // 3 * 3
		if k == 1:
			ans.append([1, 'D'])
		elif k == 2:
			ans.append([1, 'DU'])
		k = 0
		break
	if k:
		ans.append([1, 'D'])
		k -= 1
	else:
		k = 0
		break
if k:
	if k >= m - 1:
		ans.append([m - 1, 'R'])
		k -= m - 1
	else:
		ans.append([k, 'R'])
		k = 0
if k:
	if k >= m - 1:
		ans.append([m - 1, 'L'])
		k -= m - 1
	else:
		ans.append([k], 'L')
		k = 0
if k:
	if k >= n - 1:
		ans.append([n - 1, 'U'])
		k -= n - 1
	else:
		ans.append([k, 'U'])
		k = 0
print('YES')
ans1 = []
for i in ans:
	if i[0] != 0:
		ans1.append(i)
print(len(ans1))
for i in ans1:
	print(*i)


import os
import sys
from io import BytesIO, IOBase

def solve(n, m, k):
	a = []
	for _ in range(n - 1):
		if m > 1 and k:
			a.append('%d R' % min(k, m - 1))
			k -= min(k, m - 1)
		if m > 1 and k:
			a.append('%d L' % min(k, m - 1))
			k -= min(k, m - 1)
		if k >= 1:
			a.append('1 D')
			k -= 1
	if m > 1 and k >= 1:
		a.append('%d R' % min(k, m - 1))
		k -= min(k, m - 1)
	for _ in range(m - 1):
		if n > 1 and k:
			a.append('%d U' % min(k, n - 1))
			k -= min(k, n - 1)
		if n > 1 and k:
			a.append('%d D' % min(k, n - 1))
			k -= min(k, n - 1)
		if k >= 1:
			a.append('1 L')
			k -= 1
	if n > 1 and k >= 1:
		a.append('%d U' % min(k, n - 1))
		k -= min(k, n - 1)
	assert k == 0
	return a

def main():
	(n, m, k) = list(map(int, input().split()))
	if k > 4 * n * m - 2 * n - 2 * m:
		print('NO')
		return
	print('YES')
	a = solve(n, m, k)
	print(len(a))
	print('\n'.join((x for x in a)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
phase = 0
times = 0
if k > 4 * n * m - 2 * m - 2 * n:
	print('NO')
else:
	print('YES')
	output = []
	if n > 1:
		while k and times < m - 1:
			if phase == 0:
				if k >= (n - 1) * 3:
					output.append((n - 1, 'DRL'))
					k -= 3 * (n - 1)
				else:
					if k // 3:
						output.append((k // 3, 'DRL'))
					if k % 3:
						output.append((1, 'DRL'[:k % 3]))
					k = 0
			elif phase == 1:
				if k >= n - 1:
					output.append((n - 1, 'U'))
					k -= n - 1
				else:
					output.append((k, 'U'))
					k = 0
			elif phase == 2:
				output.append((1, 'R'))
				k -= 1
				times += 1
			phase += 1
			phase = phase % 3
		if k:
			output.append((min(k, n - 1), 'D'))
			k -= min(k, n - 1)
		if k:
			output.append((min(k, n - 1), 'U'))
			k -= min(k, n - 1)
	else:
		output.append((min(m - 1, k), 'R'))
		k -= min(m - 1, k)
	if k:
		output.append((k, 'L'))
	print(len(output))
	for zz in output:
		print(*zz)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, M, K):
	step = []
	if M >= N:
		RUD = 'RUD'
		R = 'R'
		L = 'L'
		D = 'D'
		U = 'U'
	else:
		RUD = 'DLR'
		R = 'D'
		L = 'U'
		D = 'R'
		U = 'L'
		(N, M) = (M, N)
	for i in range(N):
		if i != 0:
			step.append((M - 1, RUD))
		else:
			step.append((M - 1, R))
		step.append((M - 1, L))
		if i != N - 1:
			step.append((1, D))
	if N > 1:
		step.append((N - 1, U))
	ans = []
	for s in step:
		if K >= s[0] * len(s[1]):
			ans.append(s)
			K -= s[0] * len(s[1])
		elif K > 0:
			if K > len(s[1]):
				r = K // len(s[1])
				ans.append((r, s[1]))
				K -= r * len(s[1])
			if K != 0:
				ans.append((1, s[1][:K]))
				K = 0
	if K == 0:
		print('YES')
		print(len(ans))
		for (n, s) in ans:
			print('%d %s' % (n, s))
	else:
		print('NO')

def main():
	(N, M, K) = read_int_n()
	slv(N, M, K)
main()


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
elif n == 1:
	print('YES')
	if 1 <= k <= m - 1:
		print(1)
		print(k, 'R')
	else:
		print(2)
		print(m - 1, 'R')
		print(k - m + 1, 'L')
elif m == 1:
	print('YES')
	if 1 <= k <= n - 1:
		print(1)
		print(k, 'D')
	else:
		print(2)
		print(n - 1, 'D')
		print(k - n + 1, 'U')
else:
	print('YES')
	if k <= n - 1:
		print(1)
		print(k, 'D')
	elif n <= k <= 4 * n * m - 3 * m - 3 * n + 2:
		k -= n - 1
		div = k // (4 * n - 3)
		rem = k % (4 * n - 3)
		if rem == 0:
			print(1 + 3 * div)
			print(n - 1, 'D')
			for i in range(div):
				print(n - 1, 'U')
				print(n - 1, 'RDL')
				print(1, 'R')
		elif 1 <= rem <= n - 1:
			print(2 + 3 * div)
			print(n - 1, 'D')
			for i in range(div):
				print(n - 1, 'U')
				print(n - 1, 'RDL')
				print(1, 'R')
			print(rem, 'U')
		elif n <= rem <= 4 * n - 4:
			rem -= n - 1
			if rem % 3 == 0:
				print(3 + 3 * div if rem != 0 else 2 + 3 * div)
				print(n - 1, 'D')
				for i in range(div):
					print(n - 1, 'U')
					print(n - 1, 'RDL')
					print(1, 'R')
				print(n - 1, 'U')
				if rem != 0:
					print(rem // 3, 'RDL')
			else:
				print(4 + 3 * div if rem // 3 != 0 else 3 + 3 * div)
				print(n - 1, 'D')
				for i in range(div):
					print(n - 1, 'U')
					print(n - 1, 'RDL')
					print(1, 'R')
				print(n - 1, 'U')
				if rem // 3 == 0:
					pass
				else:
					print(rem // 3, 'RDL')
				print(1, 'RDL'[:rem % 3])
	else:
		k -= 4 * n * m - 3 * m - 3 * n + 2
		if 0 <= k <= n - 1:
			print(3 * m - 1)
			print(n - 1, 'D')
			for j in range(m - 1):
				print(n - 1, 'U')
				print(n - 1, 'RDL')
				print(1, 'R')
			print(k, 'U')
		else:
			print(3 * m)
			print(n - 1, 'D')
			for j in range(m - 1):
				print(n - 1, 'U')
				print(n - 1, 'RDL')
				print(1, 'R')
			print(n - 1, 'U')
			print(k - n + 1, 'L')


def main():
	(n, m, k) = [int(s) for s in input().strip().split()]
	if 4 * n * m - 2 * n - 2 * m < k:
		print('NO')
		return
	result = []
	for i in range(n - 1):
		if m > 1:
			if m - 1 <= k:
				result.append(f'{m - 1} R')
				k -= m - 1
			else:
				result.append(f'{k} R')
				k = 0
				break
			if k == 0:
				break
			if 3 * (m - 1) <= k:
				result.append(f'{m - 1} DUL')
				k -= 3 * (m - 1)
			else:
				if k >= 3:
					result.append(f'{k // 3} DUL')
					k %= 3
				if k == 2:
					result.append('1 DU')
				elif k == 1:
					result.append('1 D')
				k = 0
				break
		if k >= 1:
			result.append('1 D')
			k -= 1
		if k == 0:
			break
	if m > 1:
		if m - 1 <= k:
			result.append(f'{m - 1} R')
			k -= m - 1
		elif k > 0:
			result.append(f'{k} R')
			k = 0
		if m - 1 <= k:
			result.append(f'{m - 1} L')
			k -= m - 1
		elif k > 0:
			result.append(f'{k} L')
			k = 0
	if n > 1:
		if n - 1 <= k:
			result.append(f'{n - 1} U')
			k -= n - 1
		elif k > 0:
			result.append(f'{k} U')
			k = 0
	print('YES')
	print(len(result))
	for line in result:
		print(line)
main()


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	(n, mm, k) = RL()
	m = mm - 1
	if 2 * (mm * n * 2 - mm - n) < k:
		print('NO')
	else:
		print('YES')
		res = []
		step = 0
		now = 1
		if min(k, m) != 0:
			step += 1
		res.append((min(k, m), 'R'))
		k -= m
		if k > 0:
			if min(k, m) != 0:
				step += 1
			res.append((min(k, m), 'L'))
			k -= m
		if k > 0:
			for _ in range(n - 1):
				step += 1
				res.append((1, 'D'))
				k -= 1
				if k <= 0:
					break
				if min(k, m) != 0:
					step += 1
				res.append((min(k, m), 'R'))
				k -= m
				if k <= 0:
					break
				for _ in range(mm - 1):
					tmp = (1, 'UDL'[:min(k, 3)])
					if res[-1][1] == tmp[1]:
						res[-1] = (res[-1][0] + 1, res[-1][1])
					else:
						step += 1
						res.append(tmp)
					k -= 3
					if k <= 0:
						break
				if k <= 0:
					break
		if k > 0:
			if min(k, n) != 0:
				step += 1
			res.append((min(k, n), 'U'))
			k -= n
		print(step)
		for (n, m) in res:
			if n != 0:
				print(n, m)
main()


(n, m, k) = map(int, input().split())
steps = []
if m > 1:
	steps.append((m - 1, 'R'))
	steps.append((m - 1, 'L'))
for i in range(n - 1):
	steps.append((1, 'D'))
	if m > 1:
		steps.append((m - 1, 'R'))
		steps.append((m - 1, 'UDL'))
if n > 1:
	steps.append((n - 1, 'U'))
i = 0
while i < len(steps) and steps[i][0] * len(steps[i][1]) < k:
	k -= steps[i][0] * len(steps[i][1])
	i += 1
if i == len(steps):
	print('NO')
else:
	s = steps[i][1]
	steps = steps[:i]
	if k >= len(s):
		steps.append((k // len(s), s))
	if k % len(s) != 0:
		steps.append((1, s[:k % len(s)]))
	print('YES')
	print(len(steps))
	for (c, s) in steps:
		print(c, s)


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

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

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)
(n, m, k) = intsput()
largest = 4 * n * m - 2 * m - 2 * n
if k > largest:
	print('NO')
	exit()
print('YES')
path = []
if n > 1:
	path.append([n - 1, 'D'])
	path.append([n - 1, 'U'])
for right in range(m - 1):
	path.append([1, 'R'])
	if n > 1:
		path.append([n - 1, 'DLR'])
		path.append([n - 1, 'U'])
if m > 1:
	path.append([m - 1, 'L'])
answers = []
ran = 0
target = 0
while True:
	nxt = path[target]
	if ran + nxt[0] * len(nxt[1]) <= k:
		answers.append(nxt)
		ran += nxt[0] * len(nxt[1])
		target += 1
		if target == len(path):
			break
	else:
		left = k - ran
		fulls = left // len(nxt[1])
		if fulls:
			answers.append([fulls, nxt[1]])
		left -= fulls * len(nxt[1])
		if left:
			answers.append([1, nxt[1][:left]])
		break
print(len(answers))
for x in answers:
	print(*x)


(n, m, k) = map(int, input().split())
mx = 2 * (m - 1) * n + 2 * (n - 1) * m
have = 0
res = []
if k > mx:
	print('NO')
	exit(0)

def check(a, b):
	global k, have
	if not have + a * len(b) >= k:
		have += a * len(b)
		res.append((a, b))
		return
	bf = (k - have) // len(b)
	have += bf * len(b)
	if bf > 0:
		res.append((bf, b))
	if k <= have:
		print_res()
		return
	b = b[:k - have]
	res.append((1, b))
	print_res()

def print_res():
	print('YES')
	print(len(res))
	for i in res:
		print(i[0], i[1])
	exit(0)
for i in range(n):
	if m - 1 > 0:
		check(m - 1, 'R')
	if i != n - 1:
		if m - 1 > 0:
			check(m - 1, 'DUL')
		check(1, 'D')
	elif m - 1 > 0:
		check(m - 1, 'L')
if n - 1 > 0:
	check(n - 1, 'U')


(m, n, k) = map(int, input().split())
T = ['R', 'L', 'U', 'D']
if n < m:
	(n, m) = (m, n)
	T = ['D', 'U', 'L', 'R']
max_k = 4 * n * m - 2 * (n + m)

def print_ans():
	print(len(ans))
	for (t, k) in ans:
		print(t, k)
	exit()
if max_k < k:
	print('NO')
else:
	print('YES')
	ans = []
	if k <= n - 1:
		ans.append((k, T[0]))
		print_ans()
	ans.append((n - 1, T[0]))
	k -= n - 1
	if k <= n - 1:
		ans.append((k, T[1]))
		print_ans()
	ans.append((n - 1, T[1]))
	k -= n - 1
	if k <= (4 * (n - 1) + 1) * (m - 1):
		X = k // (4 * (n - 1) + 1)
		Y = k % (4 * (n - 1) + 1)
		for _ in range(X):
			ans.append((1, T[3]))
			ans.append((n - 1, T[0]))
			ans.append((n - 1, T[2] + T[3] + T[1]))
		if Y == 0:
			print_ans()
		if Y == 1:
			ans.append((1, T[3]))
			print_ans()
		ans.append((1, T[3]))
		Y -= 1
		if Y <= n - 1:
			ans.append((Y, T[0]))
			print_ans()
		ans.append((n - 1, T[0]))
		Y -= n - 1
		p = Y // 3
		q = Y % 3
		if p:
			ans.append((p, T[2] + T[3] + T[1]))
		if q:
			r = T[2] + T[3] + T[1]
			ans.append((1, r[:q]))
		print_ans()
	for _ in range(m - 1):
		ans.append((1, T[3]))
		ans.append((n - 1, T[0]))
		ans.append((n - 1, T[2] + T[3] + T[1]))
	k -= (4 * (n - 1) + 1) * (m - 1)
	ans.append((k, T[2]))
	print_ans()


r = 'R'
l = 'L'
u = 'U'
d = 'D'

def EPath(n, m, k):
	f = []
	a = min(m, k)
	if a != 0:
		f.append((a, r))
	if a == k:
		return f
	k = k - a
	a = min(m, k)
	if a != 0:
		f.append((a, l))
	if a == k:
		return f
	k = k - a
	for _ in range(n):
		a = min(1, k)
		if a != 0:
			f.append((a, d))
		if a == k:
			return f
		k = k - a
		a = min(m, k)
		if a != 0:
			f.append((a, r))
		if a == k:
			return f
		k = k - a
		a = min(3 * m, k)
		if a == k:
			if a // 3 != 0:
				f.append((a // 3, u + d + l))
			if a % 3 == 1:
				f.append((1, u))
			if a % 3 == 2:
				f.append((1, u + d))
			return f
		elif a != 0:
			f.append((m, u + d + l))
		k = k - a
	a = min(n, k)
	if a != 0:
		f.append((a, u))
	if a == k:
		return f
	k = k - a
	return f
(n, m, k) = (int(x) for x in input().split())
if k > 4 * n * m - n * 2 - m * 2:
	print('NO')
else:
	print('YES')
	f = EPath(n - 1, m - 1, k)
	print(len(f))
	for (i, j) in f:
		print(i, j)


(H, W, L) = map(int, input().split())
(k1, km1) = divmod(L, 2 * (W - 1) + 1)
if W == 1:
	if L <= H - 1:
		print('YES')
		print(1)
		print(L, 'D')
	elif L <= 2 * (H - 1):
		print('YES')
		print(2)
		print(H - 1, 'D')
		print(L - (H - 1), 'U')
	else:
		print('NO')
elif H == 1:
	if L <= W - 1:
		print('YES')
		print(1)
		print(L, 'R')
	elif L <= 2 * (W - 1):
		print('YES')
		print(2)
		print(W - 1, 'R')
		print(L - (W - 1), 'L')
	else:
		print('NO')
elif L <= (H - 1) * (2 * (W - 1) + 1):
	print('YES')
	Rs = []
	for i in range(k1):
		if W != 1:
			Rs.append((W - 1, 'R'))
			Rs.append((W - 1, 'L'))
		Rs.append((1, 'D'))
	if km1:
		if km1 <= W - 1:
			Rs.append((km1, 'R'))
		else:
			Rs.append((W - 1, 'R'))
			Rs.append((km1 - W + 1, 'L'))
	print(len(Rs))
	for (x, y) in Rs:
		print(x, y)
elif L <= (H - 1) * (2 * (W - 1) + 1) + W - 1:
	print('YES')
	Rs = []
	for i in range(H - 1):
		Rs.append((W - 1, 'R'))
		Rs.append((W - 1, 'L'))
		Rs.append((1, 'D'))
	Rs.append((L - (H - 1) * (2 * (W - 1) + 1), 'R'))
	print(len(Rs))
	for (x, y) in Rs:
		print(x, y)
elif L <= (H - 1) * (2 * (W - 1) + 1) + W - 1 + (W - 1) * (2 * (H - 1) + 1):
	print('YES')
	Rs = []
	for i in range(H - 1):
		Rs.append((W - 1, 'R'))
		Rs.append((W - 1, 'L'))
		Rs.append((1, 'D'))
	Rs.append((W - 1, 'R'))
	L -= (H - 1) * (2 * (W - 1) + 1) + W - 1
	(k2, km2) = divmod(L, 2 * (H - 1) + 1)
	for i in range(k2):
		Rs.append((H - 1, 'U'))
		Rs.append((H - 1, 'D'))
		Rs.append((1, 'L'))
	if km2:
		if km2 <= H - 1:
			Rs.append((km2, 'U'))
		else:
			Rs.append((H - 1, 'U'))
			Rs.append((km2 - H + 1, 'D'))
	print(len(Rs))
	for (x, y) in Rs:
		print(x, y)
elif L <= (H - 1) * (2 * (W - 1) + 1) + W - 1 + (W - 1) * (2 * (H - 1) + 1) + H - 1:
	print('YES')
	Rs = []
	for i in range(H - 1):
		Rs.append((W - 1, 'R'))
		Rs.append((W - 1, 'L'))
		Rs.append((1, 'D'))
	Rs.append((W - 1, 'R'))
	L -= (H - 1) * (2 * (W - 1) + 1) + W - 1
	(k2, km2) = divmod(L, 2 * (H - 1) + 1)
	for i in range(W - 1):
		Rs.append((H - 1, 'U'))
		Rs.append((H - 1, 'D'))
		Rs.append((1, 'L'))
	Rs.append((L - (W - 1) * (2 * (H - 1) + 1), 'U'))
	print(len(Rs))
	for (x, y) in Rs:
		print(x, y)
else:
	print('NO')


import sys
input = sys.stdin.readline
import math

def solve(n, m, k):
	if 4 * n * m - 2 * n - 2 * m < k:
		print('NO')
		return
	print('YES')
	if m == 1:
		if k <= n - 1:
			print(1)
			print(str(k) + ' D')
			return
		else:
			print(2)
			print(str(n - 1) + ' D')
		print(str(k - n + 1) + ' U')
		return
	ans = ''
	lenA = 4 * (m - 1) + 1
	cycle = min(k // lenA, n - 1)
	for i in range(cycle):
		if m - 1 > 0:
			ans += str(m - 1) + ' RDU\n'
			ans += str(m - 1) + ' L\n'
			ans += '1 D\n'
	rest = k - cycle * lenA
	if cycle < n - 1:
		rdus = min(rest // 3, m - 1)
		if rdus > 0:
			ans += str(rdus) + ' RDU\n'
		if rdus < m - 1:
			rest2 = rest % 3
			if rest2 == 2:
				ans += '1 RD\n'
			elif rest2 == 1:
				ans += '1 R\n'
			print(ans.count('\n'))
			print(ans, end='')
			return
		rest -= (m - 1) * 3
		if rest <= m - 1:
			if rest > 0:
				ans += str(rest) + ' L\n'
			print(ans.count('\n'))
			print(ans, end='')
			return
		elif m - 1 > 0:
			ans += str(m - 1) + ' L\n'
		if rest == 1:
			ans += str(rest) + ' D\n'
			print(ans.count('\n'))
			print(ans, end='')
			return
	if rest < m - 1:
		if rest > 0:
			ans += str(rest) + ' R\n'
		print(ans.count('\n'))
		print(ans, end='')
		return
	elif m - 1 > 0:
		ans += str(m - 1) + ' R\n'
	rest -= m - 1
	if rest < m - 1:
		if rest > 0:
			ans += str(rest) + ' L\n'
		print(ans.count('\n'))
		print(ans, end='')
		return
	else:
		ans += str(m - 1) + ' L\n'
	rest -= m - 1
	if rest < n - 1:
		if rest > 0:
			ans += str(rest) + ' U\n'
		print(ans.count('\n'))
		print(ans, end='')
		return
	elif n - 1 > 0:
		ans += str(n - 1) + ' U\n'
	print(ans.count('\n'))
	print(ans, end='')
	return
(n, m, k) = [int(item) for item in input().split()]
solve(n, m, k)


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	exit(0)
print('YES')
res = []
for i in range(n):
	if m > 1:
		res.append([m - 1, 'R'])
	if i == 0 and m > 1:
		res.append([m - 1, 'L'])
	elif m > 1:
		res.append([m - 1, 'UDL'])
	if i != n - 1:
		res.append([1, 'D'])
if n > 1:
	res.append([n - 1, 'U'])
ans = []
for i in res:
	if i[0] * len(i[1]) <= k:
		ans.append(i)
		k -= i[0] * len(i[1])
	else:
		if k // len(i[1]):
			ans.append([k // len(i[1]), i[1]])
		k %= len(i[1])
		if k:
			ans.append([1, i[1][:k]])
		k = 0
	if k == 0:
		break
print(len(ans))
for i in ans:
	print(*i)


(n, m, k) = map(int, input().split())
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
else:
	print('YES')
	ans = [0]
	if m == 1:
		if k <= n - 1:
			ans[0] += 1
			ans.append(k)
			ans.append('D')
		else:
			ans[0] += 2
			ans.append(n - 1)
			ans.append('D')
			ans.append(k - (n - 1))
			ans.append('U')
	elif k <= m - 1:
		ans[0] += 1
		ans.append(k)
		ans.append('R')
	elif k <= 2 * (m - 1):
		ans[0] += 2
		ans.append(m - 1)
		ans.append('R')
		ans.append(k - (m - 1))
		ans.append('L')
	else:
		k -= 2 * (m - 1)
		ans[0] += 2
		ans.append(m - 1)
		ans.append('R')
		ans.append(m - 1)
		ans.append('L')
		level = k // (1 + 4 * (m - 1))
		if level <= n - 1:
			for i in range(level):
				ans[0] += 3
				ans.append(1)
				ans.append('D')
				ans.append(m - 1)
				ans.append('RUD')
				ans.append(m - 1)
				ans.append('L')
			k -= level * (1 + 4 * (m - 1))
			if level == n - 1:
				if k > 0:
					ans[0] += 1
					ans.append(k)
					ans.append('U')
			else:
				if k > 0:
					k -= 1
					ans[0] += 1
					ans.append(1)
					ans.append('D')
				if k > 0:
					if k <= 3 * (m - 1):
						times = k // 3
						k -= times * 3
						if times:
							ans[0] += 1
							ans.append(times)
							ans.append('RUD')
						if k:
							ans[0] += 1
							ans.append(1)
							if k == 1:
								ans.append('R')
							elif k == 2:
								ans.append('RU')
							else:
								ans.append('RUD')
					else:
						k -= 3 * (m - 1)
						ans[0] += 1
						ans.append(m - 1)
						ans.append('RUD')
						ans[0] += 1
						ans.append(k)
						ans.append('L')
		else:
			for i in range(n - 1):
				ans[0] += 3
				ans.append(1)
				ans.append('D')
				ans.append(m - 1)
				ans.append('RUD')
				ans.append(m - 1)
				ans.append('L')
			k -= (n - 1) * (1 + 4 * (m - 1))
			ans[0] += 1
			ans.append(k)
			ans.append('L')
	print(ans[0])
	anslen = len(ans)
	for i in range(1, anslen, 2):
		print(ans[i], ans[i + 1])


import sys
from math import *
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
c = 0
i = 0
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	exit(0)
d = []
m -= 1
while True:
	if i == 0:
		if k <= m and m > 0:
			d.append([k, 'R'])
			break
		if m > 0:
			d.append([m, 'R'])
			c += m
		if c + m >= k and m > 0:
			d.append([k - c, 'L'])
			break
		elif m > 0:
			d.append([m, 'L'])
			c += m
		d.append([1, 'D'])
		c += 1
		if c == k:
			break
	elif i != n - 1:
		if c + m >= k and m > 0:
			d.append([k - c, 'R'])
			break
		elif m > 0:
			d.append([m, 'R'])
			c += m
		if (k - c) // 3 < m:
			if (k - c) // 3 > 0:
				d.append([(k - c) // 3, 'UDL'])
			if (k - c) % 3 > 0:
				d.append([1, 'UDL'[:(k - c) % 3]])
			break
		elif (k - c) // 3 == m and (k - c) % 3 == 0 and (m > 0):
			d.append([(k - c) // 3, 'UDL'])
			break
		elif m > 0:
			d.append([m, 'UDL'])
			c += m * 3
		d.append([1, 'D'])
		c += 1
		if c == k:
			break
	else:
		if c + m >= k and m > 0:
			d.append([k - c, 'R'])
			break
		elif m > 0:
			d.append([m, 'R'])
			c += m
		if (k - c) // 3 < m:
			if (k - c) // 3 > 0:
				d.append([(k - c) // 3, 'UDL'])
			if (k - c) % 3 > 0:
				d.append([1, 'UDL'[:(k - c) % 3]])
			break
		elif (k - c) // 3 == m and (k - c) % 3 == 0 and (m > 0):
			d.append([(k - c) // 3, 'UDL'])
			break
		elif m > 0:
			d.append([m, 'UDL'])
			c += m * 3
		d.append([k - c, 'U'])
		break
	i += 1
print('YES')
print(len(d))
for i in d:
	print(*i)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def printans(l):
	tot = len(l)
	for i in l:
		if not i[1]:
			tot -= 1
	print(tot)
	for i in l:
		if i[1]:
			print(*i[::-1])
(n, m, k) = li()
l = []
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	exit()
print('YES')
for i in range(1):
	temp = min(k, m - 1)
	k -= temp
	l.append(['R', temp])
	if not k:
		break
	temp = min(k, m - 1)
	k -= temp
	l.append(['L', temp])
if not k:
	printans(l)
	exit()
if k:
	l.append(['D', 1])
	k -= 1
	if not k:
		printans(l)
		exit()
for i in range(n - 1):
	if k > (m - 1) * 3 + (m - 1):
		l.append(['RUD', m - 1])
		k -= (m - 1) * 3
		l.append(['L', m - 1])
		k -= m - 1
	else:
		temp = min(k // 3, m - 1)
		l.append(['RUD', temp])
		k -= temp * 3
		if not k:
			break
		if temp < m - 1:
			if k == 1:
				l.append(['R', 1])
			else:
				l.append(['RU', 1])
		else:
			l.append(['L', k])
		k = 0
		break
	if k and i != n - 2:
		k -= 1
		l.append(['D', 1])
	if not k:
		break
if not k:
	printans(l)
	exit()
l.append(['U', k])
printans(l)


(r, c, k) = map(int, input().split())
drogi = 2 * (r * (c - 1) + c * (r - 1))
if k > drogi:
	print('NO')
else:
	print('YES')
	odp = []
	for i in range(c):
		if i == 0:
			odp.append([r - 1, 'D'])
			if i < c - 1:
				odp.append([1, 'R'])
		elif i % 2 == 1:
			odp.append([r - 1, 'ULR'])
			if i < c - 1:
				odp.append([1, 'R'])
		else:
			odp.append([r - 1, 'DLR'])
			if i < c - 1:
				odp.append([1, 'R'])
	for i in range(c):
		j = c - i - 1
		if j % 2 == 0:
			odp.append([r - 1, 'U'])
			odp.append([1, 'L'])
		else:
			odp.append([r - 1, 'D'])
			odp.append([1, 'L'])
	t = len(odp)
	s = 0
	i = 0
	while s < k:
		s += odp[i][0] * len(odp[i][1])
		i += 1
	odp[i - 1][0] -= (s - k + len(odp[i - 1][1]) - 1) // len(odp[i - 1][1])
	odpost = []
	dupa = 0
	for j in range(i):
		if odp[j][0] > 0:
			odpost.append([odp[j][0], odp[j][1]])
			dupa += odp[j][0] * len(odp[j][1])
	poz = k - dupa
	for j in range(poz):
		odpost.append([1, odp[i - 1][1][j]])
	print(len(odpost))
	for i in odpost:
		print(i[0], i[1])


import sys
(n, m, k) = map(int, input().split())
if 4 * n * m - 2 * n - 2 * m < k:
	print('NO')
	sys.exit()
ans = []
flag = True
for i in range(n - 1):
	if k <= (m - 1) * 3:
		ans.append([k // 3, 'RDU'])
		if k % 3 == 1:
			ans.append([1, 'R'])
		elif k % 3 == 2:
			ans.append([1, 'RD'])
		flag = False
		break
	else:
		ans.append([m - 1, 'RDU'])
		k -= (m - 1) * 3
	if k <= m - 1:
		ans.append([k, 'L'])
		flag = False
		break
	else:
		ans.append([m - 1, 'L'])
		k -= m - 1
	ans.append([1, 'D'])
	k -= 1
for i in range(1):
	if not flag or k <= 0:
		break
	if k <= m - 1:
		ans.append([k, 'R'])
		break
	else:
		ans.append([m - 1, 'R'])
		k -= m - 1
	if k <= m - 1:
		ans.append([k, 'L'])
		break
	else:
		ans.append([m - 1, 'L'])
		k -= m - 1
	if k <= n - 1:
		ans.append([k, 'U'])
		break
	else:
		ans.append([n - 1, 'U'])
		k -= n - 1
		break
print('YES')
ans2 = []
for (i, j) in ans:
	if i != 0:
		ans2.append([i, j])
print(len(ans2))
for (i, j) in ans2:
	print(i, j)


import sys
input = sys.stdin.readline
import math
import copy
import collections
from collections import deque

def solve(ans):
	print(len(ans))
	for ele in ans:
		print(ele[0], ele[1])
(n, m, k) = map(int, input().split())
count = 0
ans = []
if 4 * n * m - 2 * n - 2 * m < k:
	print('NO')
elif n == 1:
	print('YES')
	if m - 1 >= k:
		ans.append([k, 'R'])
		solve(ans)
		quit()
	else:
		ans.append([m - 1, 'R'])
		k -= m - 1
	ans.append([k, 'L'])
	solve(ans)
elif m == 1:
	print('YES')
	if n - 1 >= k:
		ans.append([k, 'D'])
		solve(ans)
		quit()
	else:
		ans.append([n - 1, 'D'])
		k -= n - 1
	ans.append([k, 'U'])
	solve(ans)
else:
	print('YES')
	if n - 1 >= k:
		ans.append([k, 'D'])
		solve(ans)
		quit()
	else:
		k -= n - 1
		count += 1
		ans.append([n - 1, 'D'])
	row = n - 1
	while row > 0:
		if m - 1 >= k:
			ans.append([k, 'R'])
			solve(ans)
			quit()
		else:
			k -= m - 1
			count += 1
			ans.append([m - 1, 'R'])
		if m - 1 >= k:
			ans.append([k, 'L'])
			solve(ans)
			quit()
		else:
			k -= m - 1
			count += 1
			ans.append([m - 1, 'L'])
		count += 1
		ans.append([1, 'U'])
		k -= 1
		if k == 0:
			solve(ans)
			quit()
		row -= 1
	col = 0
	while col < m - 1:
		col += 1
		count += 1
		ans.append([1, 'R'])
		k -= 1
		if k == 0:
			solve(ans)
			quit()
		if n - 1 >= k:
			ans.append([k, 'D'])
			solve(ans)
			quit()
		else:
			count += 1
			k -= n - 1
			ans.append([n - 1, 'D'])
		if n - 1 >= k:
			ans.append([k, 'U'])
			solve(ans)
			quit()
		else:
			count += 1
			k -= n - 1
			ans.append([n - 1, 'U'])
	count += 1
	ans.append([k, 'L'])
	solve(ans)


(n, m, k) = map(int, input().split())
chk = 4 * n * m - 2 * n - 2 * m
if k <= chk:
	print('YES')
else:
	print('NO')
	exit()
q = (m - 1) // 4
r = (m - 1) % 4
a = []
if n == 1 and m > 1:
	if k <= m - 1:
		q1 = k // 4
		r1 = k % 4
		if q1 != 0:
			a.append([q1, 'RRRR'])
		if r1 != 0:
			a.append([1, 'R' * r1])
	else:
		if q != 0:
			a.append([q, 'RRRR'])
		if r != 0:
			a.append([1, 'R' * r])
		x = k - m + 1
		q1 = x // 4
		r1 = x % 4
		if q1 != 0:
			a.append([q1, 'LLLL'])
		if r1 != 0:
			a.append([1, 'L' * r1])
elif n > 1 and m == 1:
	q = (n - 1) // 4
	r = (n - 1) % 4
	if k <= n - 1:
		q1 = k // 4
		r1 = k % 4
		if q1 != 0:
			a.append([q1, 'DDDD'])
		if r1 != 0:
			a.append([1, 'D' * r1])
	else:
		if q != 0:
			a.append([q, 'DDDD'])
		if r != 0:
			a.append([1, 'D' * r])
		x = k - n + 1
		q1 = x // 4
		r1 = x % 4
		if q1 != 0:
			a.append([q1, 'UUUU'])
		if r1 != 0:
			a.append([1, 'U' * r1])
elif n > 1 and m > 1:
	quanta = 2 * (m - 1) + 2 * m - 1
	rep = k // quanta
	p = rep
	rrep = k % quanta
	if rep > n - 1:
		rep = n - 1
		p = rep
		rrep = k - quanta * rep
	while rep != 0:
		if q != 0:
			a.append([q, 'RRRR'])
		if r != 0:
			a.append([1, 'R' * r])
		a.append([m - 1, 'DUL'])
		a.append([1, 'D'])
		rep -= 1
	if rrep <= 2 * (m - 1) + n - 1 and p == n - 1 and (rrep != 0):
		if rrep <= m - 1:
			q1 = rrep // 4
			r1 = rrep % 4
			if q1 != 0:
				a.append([q1, 'RRRR'])
			if r1 != 0:
				a.append([1, 'R' * r1])
		elif rrep <= 2 * (m - 1):
			if q != 0:
				a.append([q, 'RRRR'])
			if r != 0:
				a.append([1, 'R' * r])
			x = rrep - m + 1
			q1 = x // 4
			r1 = x % 4
			if q1 != 0:
				a.append([q1, 'LLLL'])
			if r1 != 0:
				a.append([1, 'L' * r1])
		else:
			if q != 0:
				a.append([q, 'RRRR'])
			if r != 0:
				a.append([1, 'R' * r])
			if q != 0:
				a.append([q, 'LLLL'])
			if r != 0:
				a.append([1, 'L' * r])
			y = rrep - 2 * (m - 1)
			q2 = y // 4
			r2 = y % 4
			if q2 != 0:
				a.append([q2, 'UUUU'])
			if r2 != 0:
				a.append([1, 'U' * r2])
	elif rrep != 0:
		if rrep >= m - 1:
			if q != 0:
				a.append([q, 'RRRR'])
			if r != 0:
				a.append([1, 'R' * r])
			x = rrep - m + 1
			q1 = x // 3
			r1 = x % 3
			if q1 != 0:
				a.append([q1, 'DUL'])
			if r1 != 0:
				if r1 == 1:
					a.append([1, 'D'])
				elif r1 == 2:
					a.append([1, 'DU'])
		else:
			q1 = rrep // 4
			r1 = rrep % 4
			if q1 != 0:
				a.append([q1, 'RRRR'])
			if r1 != 0:
				a.append([1, 'R' * r1])
print(len(a))
for i in a:
	print(i[0], i[1])


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n, m, k) = I()
if k > 4 * m * n - 2 * (m + n):
	print('NO')
	exit()
print('YES')
res = []
if m - 1:
	res.append([min(m - 1, k), 'R'])
	k -= min(m - 1, k)
if k and m - 1:
	res.append([min(m - 1, k), 'L'])
	k -= min(m - 1, k)
if k:
	res.append([1, 'D'])
	k -= 1
row = 1
while k and row < n:
	row += 1
	if k >= 3 * (m - 1):
		if m - 1:
			res.append([m - 1, 'RUD'])
			k -= (m - 1) * 3
	else:
		if k // 3:
			res.append([k // 3, 'RUD'])
			k = k % 3
		if k:
			res.append([1, 'RUD'[:k]])
			k = 0
	if k and m - 1:
		res.append([min(m - 1, k), 'L'])
		k -= min(m - 1, k)
	if k and row != n:
		res.append([1, 'D'])
		k -= 1
if k:
	res.append([k, 'U'])
print(len(res))
for i in res:
	print(*i)


def main():
	import sys
	input = sys.stdin.readline
	(n, m, k) = map(int, input().split())
	tot = 4 * n * m - 2 * n - 2 * m
	if k > tot:
		print('NO')
		return
	ans = []
	run = 0
	for i in range(n):
		if i == 0:
			(x, move) = (m - 1, 'R')
			dist = m - 1
			if run + dist >= k:
				x = k - run
				ans.append((x, move))
				break
			ans.append((x, move))
			run += x
		else:
			(x, move) = (m - 1, 'RUD')
			dist = (m - 1) * 3
			if run + dist >= k:
				left = k - run
				x = left // 3
				ans.append((x, move))
				if left % 3 == 1:
					ans.append((1, 'R'))
				elif left % 3 == 2:
					ans.append((1, 'RU'))
				break
			ans.append((x, move))
			run += x * 3
		(x, move) = (m - 1, 'L')
		dist = m - 1
		if run + dist >= k:
			x = k - run
			ans.append((x, move))
			break
		ans.append((x, move))
		run += x
		if i < n - 1:
			(x, move) = (1, 'D')
			dist = 1
			if run + dist >= k:
				ans.append((x, move))
				break
			ans.append((x, move))
			run += x
		else:
			(x, move) = (n - 1, 'U')
			dist = n - 1
			if run + dist >= k:
				x = k - run
				ans.append((x, move))
				break
			ans.append((x, move))
			run += x
	print('YES')
	cnt = 0
	for tu in ans:
		if tu[0] > 0:
			cnt += 1
	print(cnt)
	for tu in ans:
		if tu[0] > 0:
			print(*tu)
main()


(n, m, k) = map(int, input().split())
while True:
	if k > 4 * m * n - 2 * n - 2 * m:
		print('NO')
		break
	ans = []
	for _ in range(n - 1):
		ans.append([min(m - 1, k), 'R'])
		k -= min(m - 1, k)
		ans.append([min(m - 1, k), 'L'])
		k -= min(m - 1, k)
		ans.append([min(1, k), 'D'])
		k -= min(1, k)
	for _ in range(m - 1):
		ans.append([min(1, k), 'R'])
		k -= min(1, k)
		ans.append([min(n - 1, k), 'U'])
		k -= min(n - 1, k)
		ans.append([min(n - 1, k), 'D'])
		k -= min(n - 1, k)
	ans.append([min(m - 1, k), 'L'])
	k -= min(m - 1, k)
	ans.append([min(n - 1, k), 'U'])
	k -= min(n - 1, k)
	ans2 = []
	for x in ans:
		if x[0] != 0:
			ans2.append(x)
	print('YES')
	print(len(ans2))
	for y in ans2:
		print(y[0], y[1])
	break


(n, m, k) = map(int, input().split())
steps = []

def go(dir, amount):
	global k, steps
	x = min(k, amount)
	if x > 0:
		steps.append((x, dir))
		k -= x
if k > 4 * n * m - 2 * n - 2 * m:
	print('NO')
	exit(0)
go('D', n - 1)
for x in range(n - 1):
	go('R', m - 1)
	go('L', m - 1)
	go('U', 1)
go('R', m - 1)
for x in range(m - 1):
	go('D', n - 1)
	go('U', n - 1)
	go('L', 1)
print('YES')
print(len(steps))
for t in steps:
	print(*t)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
MAX = 4 * n * m - 2 * n - 2 * m
if k > MAX:
	print('NO')
	sys.exit()
ANS = []
ANS.append((m - 1, 'R'))
ANS.append((m - 1, 'L'))
for i in range(n - 1):
	ANS.append((1, 'D'))
	ANS.append((m - 1, 'RUD'))
	ANS.append((m - 1, 'L'))
ANS.append((n - 1, 'U'))
count = 0
ANS2 = []
for (x, y) in ANS:
	if count + x * len(y) <= k:
		if x > 0:
			ANS2.append((x, y))
		k -= x * len(y)
	else:
		if k // len(y) > 0:
			ANS2.append((k // len(y), y))
			k -= k // len(y) * len(y)
		if k != 0:
			ANS2.append((1, y[:k]))
		break
print('YES')
print(len(ANS2))
for (x, y) in ANS2:
	print(x, y)