Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations:  multiply the current number by 2 (that is, replace the number x by 2·x);  append the digit 1 to the right of current number (that is, replace the number x by 10·x + 1). 

You need to help Vasily to transform the number a into the number b using only the operations described above, or find that it is impossible.

Note that in this task you are not required to minimize the number of operations. It suffices to find any way to transform a into b.


-----Input-----

The first line contains two positive integers a and b (1 ≤ a < b ≤ 10^9) — the number which Vasily has and the number he wants to have.


-----Output-----

If there is no way to get b from a, print "NO" (without quotes).

Otherwise print three lines. On the first line print "YES" (without quotes). The second line should contain single integer k — the length of the transformation sequence. On the third line print the sequence of transformations x_1, x_2, ..., x_{k}, where:  x_1 should be equal to a,  x_{k} should be equal to b,  x_{i} should be obtained from x_{i} - 1 using any of two described operations (1 < i ≤ k). 

If there are multiple answers, print any of them.


-----Examples-----
Input
2 162

Output
YES
5
2 4 8 81 162 

Input
4 42

Output
NO

Input
100 40021

Output
YES
5
100 200 2001 4002 40021

Difficulty: EASY
Tags: Graph traversal

Mathematics

Complete search
Skill types: Complete search

Starter code:

Solutions:
[a, b] = map(int, input().split())
ans = []
while b != a:
	if b % 10 == 1:
		ans.append(b)
		b //= 10
	elif b % 2 == 0 and b > 0:
		ans.append(b)
		b //= 2
	else:
		break
if a == b:
	print('YES')
	ans.append(a)
	ans.reverse()
	print(len(ans))
	for i in ans:
		print(i, end=' ')
else:
	print('NO')


(a, b) = [int(x) for x in input().split()]
lista = []
aux = b
resp = 'NO'
while aux > a:
	lista.append(str(int(aux)))
	if aux % 2 == 0:
		aux /= 2
	else:
		aux -= 1
		if aux % 10 == 0:
			aux /= 10
		else:
			break
	if aux == a:
		resp = 'YES'
		lista.append(str(int(aux)))
if resp == 'YES':
	print(resp)
	print(len(lista))
	lista.reverse()
	print(' '.join(lista))
else:
	print(resp)


cin = input().split(' ')
a = int(cin[0])
b = int(cin[1])
x = []
while b > a:
	x.append(b)
	if b % 10 == 1:
		b = (b - 1) // 10
	elif b % 2 == 0:
		b //= 2
	else:
		break
x.append(b)
if b == a:
	x.reverse()
	print('YES\n', len(x), sep='')
	for i in x:
		print(i, end=' ')
else:
	print('NO')


def from_a_2_b(a, b):
	count = 1
	nums = [b]
	while a < b:
		if b % 2 == 0:
			b = b / 2
			count += 1
			nums.insert(0, int(b))
		elif b % 10 == 1:
			b = b // 10
			count += 1
			nums.insert(0, int(b))
		else:
			b = 0
	if a != b:
		print('NO')
	else:
		print('YES')
		print(count)
		print(' '.join(map(str, nums)))
(a, b) = map(int, input().split())
from_a_2_b(a, b)


(a, b) = map(int, input().split())
s = [b]
while b > a:
	if b % 2 != 0 and (b - 1) % 10 != 0:
		b = a - 1
	elif b % 2 == 0:
		s += [b // 2]
		b = b // 2
	elif (b - 1) % 10 == 0:
		s += [(b - 1) // 10]
		b = (b - 1) // 10
if b == a:
	print('YES')
	print(len(s))
	for i in range(len(s)):
		print(s[len(s) - i - 1], end=' ')
else:
	print('NO')


def get(a, b):
	if a > b:
		return None
	if a == b:
		return [b]
	c = get(a * 2, b)
	if c != None:
		return [a] + c
	c = get(a * 10 + 1, b)
	if c != None:
		return [a] + c
	return None
(a, b) = map(int, input().split())
c = get(a, b)
if c != None:
	print('YES')
	print(len(c))
	for x in c:
		print(x, end=' ')
else:
	print('NO')


enter = input().split()
a = int(enter[0])
b = int(enter[1])
output = '%i' % a
number = 1
found = []
final_out = []
final_number = []

def transformation(a, b, found, output, number, final_out, final_number):
	if a < b:
		for i in [0, 1]:
			if i == 0:
				transformation(a * 2, b, found, output + ' %i' % (a * 2), number + 1, final_out, final_number)
			else:
				transformation(a * 10 + 1, b, found, output + ' %i' % (a * 10 + 1), number + 1, final_out, final_number)
	elif a == b:
		found.append(1)
		final_out.append(output)
		final_number.append(number)
transformation(a, b, found, output, number, final_out, final_number)
if 1 in found:
	print('YES')
	print(final_number[0])
	print(final_out[0])
else:
	print('NO')


(a, b) = map(lambda x: int(x), input().split(' '))
arr = [a]
prev = dict()
pos = 0
ans = []
while pos < len(arr):
	current = arr[pos]
	if current == b:
		tmp = b
		ans.append(str(b))
		while tmp in prev:
			ans.append(str(prev[tmp]))
			tmp = prev[tmp]
		break
	if current * 2 <= b:
		arr.append(current * 2)
		prev[current * 2] = current
	if current * 10 + 1 <= b:
		arr.append(current * 10 + 1)
		prev[current * 10 + 1] = current
	pos += 1
if len(ans) > 0:
	print('YES')
	print(len(ans))
	print(' '.join(list(reversed(ans))))
else:
	print('NO')


(a, b) = map(int, input().split(' '))
ans = []
while b > a:
	if b % 2 == 0:
		ans.append(b)
		b //= 2
	elif b % 10 == 1:
		ans.append(b)
		b //= 10
	else:
		break
if b == a:
	print('YES')
	ans.append(b)
	print(len(ans))
	print(' '.join(map(str, reversed(ans))))
else:
	print('NO')


(a, b) = map(int, input().split())
fl = 1
ans = [b]
num = 1
while fl and b > a:
	if list(str(b))[-1] == '1':
		b = b // 10
		ans.append(b)
		num += 1
	elif b % 2 == 1:
		print('NO')
		fl = 0
	else:
		b //= 2
		ans.append(b)
		num += 1
ans.reverse()
if b == a:
	print('YES')
	print(num)
	print(' '.join(map(str, ans)))
elif fl == 1:
	print('NO')


def find(a, b):
	if a == b:
		return [-1]
	if a > b:
		return []
	option_a = [int(str(a) + '1')] + find(int(str(a) + '1'), b)
	option_b = [a * 2] + find(a * 2, b)
	if len(option_a) == 1 and len(option_b) == 1:
		return []
	elif len(option_a) == 1 and len(option_b) != 1:
		return option_b
	elif len(option_a) != 1 and len(option_b) == 1:
		return option_a
	else:
		return option_a
(a, b) = list(map(int, input().split()))
resp = find(a, b)
if len(resp):
	print('YES')
	print(len(resp))
	print(a, end=' ')
	for i in resp[:-1]:
		print(i, end=' ')
else:
	print('NO')


prev = dict()

def dfs(a, b):
	if a > b:
		return
	if 2 * a not in prev:
		prev[2 * a] = a
		dfs(2 * a, b)
	if 10 * a + 1 not in prev:
		prev[10 * a + 1] = a
		dfs(10 * a + 1, b)
(a, b) = map(int, input().split())
dfs(a, b)
if b not in prev:
	print('NO')
else:
	print('YES')
	path = []
	while b != a:
		path.append(b)
		b = prev[b]
	path.append(a)
	path.reverse()
	print(len(path))
	print(*path)


def Do():
	global a, b, A, t
	while t == 0:
		bb = str(b)[-1]
		if bb == '1':
			b = int(str(b)[:-1])
			A.append(b)
		elif b % 2 == 0:
			b = b // 2
			A.append(b)
		else:
			t = 2
		if b == a:
			t = 1
		elif b < a:
			t = 2
(a, b) = map(int, input().split())
t = 0
A = [b]
Do()
if t - 1:
	print('NO')
else:
	x = len(A)
	print('YES')
	print(x)
	for i in range(x - 1, -1, -1):
		print(A[i], end=' ')


inp = input().split(' ')
a = int(inp[0])
b = int(inp[1])
result = list()
while b > a:
	if b % 10 == 1:
		result.append(b)
		b /= 10
		b = int(b)
	elif b % 2 == 1:
		print('NO')
		exit()
	else:
		result.append(b)
		b /= 2
result.append(a)
if b < a:
	print('NO')
	exit()
print('YES\n')
print(len(result))
r = ''
for i in result:
	r = str(int(i)) + ' ' + r
print(r)


string = input()
wow = string.split(' ')
c = 0
for i in wow:
	if c == 1:
		b = i
		break
	a = i
	c = 1
s = b
b = int(b)
a = int(a)
c = 1
while b > a:
	c += 1
	if b % 10 == 1:
		b = b // 10
	elif b % 2 == 0:
		b = b // 2
	else:
		break
	s = str(b) + ' ' + s
if b == a:
	print('YES')
	print(c)
	print(s)
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
lista = []
lista.insert(0, b)
while b > 0:
	if b % 2 == 0:
		b /= 2
		lista.insert(0, b)
	elif (b - 1) % 10 == 0:
		b -= 1
		b /= 10
		lista.insert(0, b)
	else:
		break
	if b == a:
		break
if lista[0] != a:
	print('NO')
else:
	print('YES')
	print(len(lista))
	[print(int(e), end=' ') for e in lista]


(a, b) = map(int, input().split())
l = []
c = 1
l.append(b)
flag = False
while b > 1:
	if b % 10 == 1:
		c += 1
		b = b // 10
		l.append(b)
		if a == b:
			flag = True
			break
		if a > b:
			break
	elif b % 2 == 0:
		c += 1
		b = b // 2
		l.append(b)
		if a == b:
			flag = True
			break
		if a > b:
			break
	else:
		break
if flag:
	print('YES')
	l.sort()
	print(c)
	for i in l:
		print(i, end=' ')
else:
	print('NO')


import sys

def check(a):
	temp = inp[0]
	for i in a:
		if i == '1':
			temp *= 2
		if i == '2':
			temp = temp * 10 + 1
	if temp == inp[1]:
		return True
	else:
		return False

def printt(a):
	print('YES')
	print(len(a) + 1)
	temp = inp[0]
	print(temp, end=' ')
	for i in a:
		if i == '1':
			temp *= 2
		if i == '2':
			temp = temp * 10 + 1
		print(temp, end=' ')

def solve(a):
	if check(a):
		printt(a)
		sys.exit()
	if h(a) > inp[1]:
		return
	solve(a + '1')
	solve(a + '2')

def h(a):
	temp = inp[0]
	for i in a:
		if i == '1':
			temp *= 2
		if i == '2':
			temp = temp * 10 + 1
	return temp
inp = list(map(int, input().split()))
solve('')
print('NO')


(a, b) = map(int, input().split())
ans = []
while b != a and b > 0:
	ans = [b] + ans
	b = b // 2 if b % 2 == 0 else (b - 1) / 10
if b != a:
	print('NO')
else:
	print('YES\n%d\n%s' % (len(ans) + 1, ''.join(['%d ' % x for x in [a] + ans])))


ans = []
flag = 1

def helper(i):
	global flag, m, n, ans
	if flag == 0:
		return
	if i == m:
		flag = 0
		print('YES')
		print(len(ans) + 1)
		print(n, end=' ')
		for j in range(len(ans)):
			print(ans[j], end=' ')
		return
	if i > m:
		return
	ans.append(i * 2)
	helper(i * 2)
	ans.pop()
	ans.append(i * 10 + 1)
	helper(i * 10 + 1)
	ans.pop()
(n, m) = map(int, input().split())
helper(n)
if flag == 1:
	print('NO')


a = input()
b = []
c = []
b = a.split(' ')
b = list(map(int, b))
c.append(b[1])
while b[1] != b[0] and b[1] > b[0]:
	if b[1] % 2 == 0:
		b[1] = b[1] // 2
		c.append(b[1])
	elif b[1] % 10 == 1:
		b[1] = (b[1] - 1) // 10
		c.append(b[1])
	else:
		break
if b[1] == b[0]:
	print('YES')
	print(len(c))
	for i in range(len(c)):
		print(int(c[len(c) - i - 1]), end=' ')
else:
	print('NO')


(num_possuido, num_desejado) = map(int, input().split())
aux = []
aux.append(num_desejado)
while num_desejado > num_possuido:
	if num_desejado % 10 == 1:
		num_desejado = num_desejado // 10
		aux.append(num_desejado)
	elif num_desejado % 2 == 0:
		num_desejado = num_desejado // 2
		aux.append(num_desejado)
	else:
		print('NO')
		exit()
tamanho_da_seq = len(aux)
seq = ''
aux.reverse()
for i in aux:
	seq += str(i) + ' '
if num_desejado == num_possuido:
	print('YES')
	print(tamanho_da_seq)
	print(seq)
else:
	print('NO')


(number1, number2) = map(int, input().split())
array = []
array.append(number2)
while number2 > number1:
	if number2 % 10 == 1:
		number2 //= 10
	elif number2 % 2 == 0:
		number2 //= 2
	else:
		break
	array.append(number2)
if number2 != number1:
	print('NO')
else:
	array.reverse()
	print('YES')
	print(len(array))
	print(*array)


(a, b) = map(int, input().split())
seq = [b]
while b > a:
	if b % 2 == 0:
		b //= 2
		seq.append(b)
	elif b % 10 == 1:
		b //= 10
		seq.append(b)
	else:
		print('NO')
		exit(0)
if b != a:
	print('NO')
else:
	print('YES')
	print(len(seq))
	print(' '.join(map(str, seq[::-1])))


from collections import deque
(a, b) = map(int, input().split())
p = {}
fila = deque([a])
while fila:
	v = fila.popleft()
	if v * 2 not in p and 2 * v <= b:
		fila.append(v * 2)
		p[v * 2] = v
	if 10 * v + 1 not in p and 10 * v + 1 <= b:
		fila.append(10 * v + 1)
		p[10 * v + 1] = v
s = []
if b in p:
	print('YES')
	while True:
		s.append(b)
		b = p[b]
		if b == a:
			s.append(b)
			break
	print(len(s))
	s1 = []
	for i in range(len(s) - 1, -1, -1):
		s1.append(s[i])
	print(*s1)
else:
	print('NO')


(a, b) = input().split(' ')
a = int(a)
b = int(b)
c = []
d = 0
flag = 0
c.append(b)
while True:
	if (b - 1) % 10 == 0:
		b = (b - 1) / 10
		d += 1
		flag = 1
		c.append(b)
	elif b % 2 == 0:
		b = b / 2
		flag = 1
		c.append(b)
		d += 1
	if b <= a or flag == 0:
		break
	flag = 0
m = len(c)
if b == a:
	print('YES')
	print(m)
	for i in range(m - 1, -1, -1):
		print(int(c[i]), end=' ')
else:
	print('NO')


def main():
	(a, b) = map(int, input().split())
	nxt = [(a, None)]
	while nxt:
		(cur, nxt) = (nxt, [])
		for e in cur:
			u = e[0]
			if u == b:
				print('YES')
				res = []
				while e:
					(u, e) = e
					res.append(u)
				print(len(res))
				print(*res[::-1])
				return
			elif u < b:
				nxt.append((u * 2, e))
				nxt.append((u * 10 + 1, e))
	print('NO')
main()


(a, b) = map(int, input().split())
s = []
s.append(b)
while b > a:
	if b % 10 == 1:
		b = b // 10
		s.append(b)
	elif b % 2 == 0:
		b = b // 2
		s.append(b)
	else:
		break
if b == a:
	print('YES')
	s = sorted(s)
	print(len(s))
	print(' '.join([str(s[i]) for i in range(len(s))]))
else:
	print('NO')


(a, b) = map(int, input().split())
flag = True
cnt = 1
ans = [b]
while a < b:
	if b % 2 == 0:
		b = b // 2
	elif str(b)[-1] == '1':
		b = int(str(b)[:-1])
	else:
		flag = False
		break
	cnt += 1
	ans.append(b)
if flag == False or a > b:
	print('NO')
else:
	print('YES')
	print(cnt)
	print(*reversed(ans))


(a, b) = map(int, input().split())
res = [b]
while b >= a:
	if b == a:
		print('YES')
		res.reverse()
		print(len(res))
		print(*res)
		exit()
	if str(b)[-1] == '1':
		b = (b - 1) // 10
	elif b % 2 == 0:
		b = b // 2
	else:
		break
	res.append(b)
print('NO')


(a, b) = map(int, input().split())
stack = [b]
ans = []
h = 0
while stack:
	p = stack.pop()
	ans.append(p)
	if p == a:
		break
	elif p < a:
		h = 1
		break
	if p % 10 == 1:
		p = p // 10
		stack.append(p)
	elif p % 2 == 0:
		p = p // 2
		stack.append(p)
	else:
		h = 1
		break
ans.reverse()
if h == 1:
	print('NO')
else:
	print('YES')
	print(len(ans))
	print(*ans)


import math
(a, b) = map(int, input().split())
ans = [b]
if b % 2 != 0 and b % 10 != 1:
	print('NO')
else:
	while b > a:
		if b % 2 == 0:
			b = b // 2
			ans.append(b)
		elif b % 10 != 1:
			break
		else:
			b = b // 10
			ans.append(b)
	if b == a:
		print('YES')
		print(len(ans))
		print(*ans[::-1])
	else:
		print('NO')


def qweqwe(a, b):
	global mas
	if b % 10 in [3, 5, 7, 9] and b > a:
		mas.append('NO')
		return 0
	elif b % 10 == 1 and b > a:
		b = b // 10
		mas.append(b)
		s = qweqwe(a, b)
	elif b > a:
		b = b // 2
		mas.append(b)
		s = qweqwe(a, b)
a = [int(i) for i in input().split()]
mas = [a[1]]
b = qweqwe(a[0], a[1])
if mas[-1] == a[0]:
	print('YES')
	print(len(mas))
	for i in range(len(mas) - 1, -1, -1):
		print(mas[i], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
t = False
pp = [str(b)]
while b >= a:
	if a == b:
		t = True
		break
	elif int(str(b)[-1]) == 1:
		b = int(str(b)[0:-1])
		pp.append(str(b))
	elif b % 2 == 0:
		b = b // 2
		pp.append(str(b))
	else:
		break
if t == False:
	print('NO')
else:
	print('YES')
	print(len(pp))
	print(' '.join(pp[-1::-1]))


(a, b) = map(int, input().split())
k = []
while b > a:
	k.append(b)
	if b % 10 == 1:
		b -= 1
		b //= 10
	elif b % 2 == 0:
		b //= 2
	else:
		print('NO')
		exit()
if a == b:
	print('YES')
else:
	print('NO')
	exit()
k = k[::-1]
print(len(k) + 1)
print(a, end=' ')
print(*k, end=' ')


(a, b) = map(int, input().split())
C = []
k = 1
C.append(b)
while a < b:
	if b % 10 == 1:
		b = (b - 1) // 10
		k += 1
		C.append(b)
	elif b % 2 == 0:
		b = b // 2
		k += 1
		C.append(b)
	elif b % 2 != 0:
		break
C = list(reversed(C))
if C[0] == a:
	print('YES')
	print(k)
	print(*C)
else:
	print('NO')


(m, n) = map(int, input().split())
mylist = []
flag = True
mylist.append(n)
while n >= m:
	if n % 2 == 0:
		n = int(n / 2)
		mylist.append(n)
	else:
		n = n - 1
		if n % 10 != 0:
			flag = False
			break
		else:
			n = int(n / 10)
		mylist.append(n)
	if n == m:
		break
if m == mylist[-1] and flag == True:
	print('YES')
	print(len(mylist))
	mylist = mylist[::-1]
	for num in mylist:
		print(num, end=' ')
else:
	print('NO')


def f(l):
	u = l[-1]
	if u > a:
		if u % 10 == 1:
			l.append(u // 10)
			f(l)
		elif not u % 2:
			l.append(u // 2)
			f(l)
(a, *l) = map(int, input().split())
f(l)
if l[-1] == a:
	print('YES', len(l), sep='\n')
	print(*l[::-1])
else:
	print('NO')


(a, b) = list(map(int, input().split()))
tmp = b
arr = [str(b)]
c = 0
while tmp >= a:
	if tmp == a:
		print('YES')
		print(len(arr))
		arr = arr[::-1]
		print(' '.join(arr))
		exit()
	if tmp % 2 != 0:
		if str(tmp)[-1] != '1':
			print('NO')
			exit()
		else:
			tmp = int(str(tmp)[:-1])
	else:
		tmp = tmp // 2
	arr.append(str(tmp))
print('NO')


(a, b) = list(map(int, input().split()))
parent = {}
import queue
q = queue.Queue()
q.put(a)
visited = {}
finans = False
parent[a] = -1
while q.qsize() > 0:
	s = q.qsize()
	ans = False
	for i in range(s):
		node = q.get()
		visited[node] = True
		if node == b:
			ans = True
			break
		elif node > b:
			break
		l = 2 * node
		r = node * 10 + 1
		parent[l] = node
		parent[r] = node
		if l not in visited and l <= b:
			q.put(l)
		if r not in visited and r <= b:
			q.put(r)
	if ans == True:
		finans = True
		break
if finans == False:
	print('NO')
else:
	print('YES')
	p = b
	arr = []
	while parent[p] != -1:
		arr.append(p)
		p = parent[p]
	arr.append(a)
	print(len(arr))
	for i in range(len(arr) - 1, -1, -1):
		print(arr[i], end=' ')
	print()


(a, b) = map(int, input().split())
d = b
k = 1
A = []
while a != b and b > a:
	if b % 2 == 0:
		b //= 2
		A.append(b)
		k += 1
	elif b % 10 == 1:
		b //= 10
		A.append(b)
		k += 1
	else:
		break
if a == b:
	A.reverse()
	A.append(d)
	print('YES')
	print(k)
	print(' '.join(map(str, A)))
else:
	print('NO')


def f(l):
	u = l[-1]
	if u > l[0]:
		if u % 10 == 1:
			l.append(u // 10)
			f(l)
		elif not u % 2:
			l.append(u // 2)
			f(l)
l = list(map(int, input().split()))
f(l)
if l.pop(0) == l[-1]:
	print('YES', len(l), sep='\n')
	print(*l[::-1])
else:
	print('NO')


(a, b) = map(int, input().split())
f = 0
ans = [b]
steps = 0
while b > a:
	if b % 10 == 1:
		b = b // 10
		ans.append(b)
	elif b % 10 % 2 == 0:
		b = b // 2
		ans.append(b)
	else:
		break
	if b == a:
		f = 1
		break
if f == 1:
	print('YES')
	print(len(ans))
	print(*ans[::-1])
else:
	print('NO')


__author__ = 'Think'

def reduce(n):
	if n % 10 == 1:
		return (n - 1) // 10
	elif n % 2 == 0:
		return n // 2
	else:
		return -2
(a, b) = [int(i) for i in input().split()]
answers = [b]
working = True
while b > a:
	b = reduce(b)
	if b == -2:
		working = False
		break
	else:
		answers.append(b)
if b == a and working:
	print('YES')
	print(len(answers))
	for i in reversed(answers):
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
result = []
j = b
result.append(j)
while j > a:
	if j % 2 == 0:
		j = j // 2
	elif j % 10 == 1:
		j = (j - 1) // 10
	else:
		break
	result.append(j)
if j != a:
	print('NO')
else:
	print('YES')
	print(len(result))
	result.reverse()
	print(' '.join(map(str, result)))


def find_num(start, target):
	global sequence
	if start == target:
		return start
	elif start > target:
		return
	else:
		l = find_num(start * 2, target)
		if l:
			sequence.append(l)
			return start
		r = find_num(start * 10 + 1, target)
		if r:
			sequence.append(r)
			return start
(a, b) = [int(x) for x in input().split()]
sequence = []
find_num(a, b)
if len(sequence) == 0:
	print('NO')
else:
	sequence.append(a)
	sequence.reverse()
	print('YES')
	print(len(sequence))
	for x in sequence:
		print(x, end=' ')


from collections import deque as d
(a, b) = map(int, input().split())
ans = True
l = d()
l.append(b)
while True:
	if b == a:
		break
	elif b < a:
		ans = False
		break
	if not b % 2:
		b //= 2
		l.append(b)
	elif b % 10 == 1:
		b //= 10
		l.append(b)
	else:
		ans = False
		break
if ans:
	print('YES')
	print(len(l))
	l.reverse()
	print(*l)
else:
	print('NO')


(a, b) = list(map(int, input().split()))
ans = [b]
f = 0
prev = b
while b > a:
	if str(b)[-1] == '1':
		b = b // 10
		ans.append(b)
	elif b % 2 == 0:
		b = b // 2
		ans.append(b)
	if a == b:
		f = 1
		break
	if prev == b:
		break
	else:
		prev = b
if f == 0:
	print('NO')
else:
	ans = ans[-1::-1]
	print('YES')
	print(len(ans))
	print(*ans)


(b, a) = map(int, input().split())
l = [a]
while b != a:
	if a <= 0:
		print('NO')
		break
	if str(a)[-1] == '1':
		a = (a - 1) // 10
	elif a % 2 == 0:
		a = a // 2
	else:
		print('NO')
		break
	l.append(a)
else:
	print('YES')
	l.sort()
	print(len(l))
	print(*l)


(a, b) = map(int, input().split())
steps = list()
steps.append(b)
Done = False
while b != a:
	if (b - 1) % 10 == 0:
		b = (b - 1) // 10
		steps.append(b)
	if b % 2 == 0 and b != a:
		b = b // 2
		steps.append(b)
	if (b - 1) % 10 != 0 and b % 2 != 0 and (b != a) or b < a:
		print('NO')
		Done = True
		break
if Done is False:
	print('YES')
	print(len(steps))
	steps.reverse()
	print(' '.join(map(str, steps)))


(a, b) = map(int, input().split())
steps = [b]
while True:
	if b < a:
		print('NO')
		import sys
		sys.exit(0)
	if b == a:
		break
	if b % 2 == 0:
		b //= 2
		steps.append(b)
		continue
	if b % 10 != 1:
		b = -1
	else:
		b = (b - 1) // 10
		steps.append(b)
print('YES')
print(len(steps))
print(' '.join(reversed([str(s) for s in steps])))


s = input().split()
a = int(s[0])
b = int(s[1])
res = [a]
ST = [str(a) + '-']
step = 0
while b not in res:
	result = []
	step += 1
	R = []
	for i in range(len(res)):
		X = res[i] * 2
		if X <= 10 ** 9:
			result.append(X)
			R.append(ST[i] + str(X) + '-')
		Y = res[i] * 10 + 1
		if Y <= 10 ** 9:
			result.append(Y)
			R.append(ST[i] + str(Y) + '-')
	res = result
	ST = R
	if step >= 30:
		print('NO')
		break
else:
	otvet = []
	for i in range(len(ST)):
		ST[i] = ST[i].split('-')
		for y in range(len(ST[i]) - 1):
			ST[i][y] = int(ST[i][y])
		if b in ST[i]:
			otvet = ST[i]
			break
	print('YES')
	print(len(otvet) - 1)
	S = []
	for i in range(len(otvet) - 1):
		S.append(str(otvet[i]))
	print(' '.join(S))


(a, b) = list(map(int, input().split()))
result = []
result.append(b)
while b > a:
	if b % 2 == 0:
		b = b // 2
		result.insert(0, b)
	if b % 10 == 1 and b != 1:
		b = (b - 1) // 10
		result.insert(0, b)
	if b == a:
		print('YES')
		print(len(result))
		for i in range(len(result)):
			print(result[i], ' ', end='')
		break
	elif b % 2 != 0 and b % 10 != 1 or b < a:
		print('NO')
		break


(a, b) = map(int, input().split())
ans = []
check = True
while True:
	ans.insert(0, b)
	if b % 2 == 0:
		b //= 2
	elif str(b)[-1] == '1':
		b = int(str(b)[:-1])
	else:
		check = False
		break
	if b == a:
		ans.insert(0, b)
		break
	elif a > b:
		check = False
		break
if check:
	print('YES')
	print(len(ans))
	for x in ans:
		print(x, end=' ')
else:
	print('NO')


n = []

def a_to_b(a, b):
	if b % 2 == 0:
		b = b / 2
		if b >= a:
			n.insert(0, int(b))
			a_to_b(a, b)
	elif b % 10 == 1:
		b = b // 10
		if b >= a:
			n.insert(0, int(b))
			a_to_b(a, b)
(a, b) = map(int, input().split())
a_to_b(a, b)
n.append(b)
if a in n:
	print('YES')
	print(len(n))
	print(' '.join(map(str, n)))
else:
	print('NO')


import sys
sys.setrecursionlimit(1000000000)

def dfs(a):
	global b, ans_list, victory
	if a > b:
		return
	if a == b:
		victory = True
		return
	dfs(a * 2)
	if victory:
		ans_list.insert(0, a * 2)
		return
	dfs(a * 10 + 1)
	if victory:
		ans_list.insert(0, a * 10 + 1)
		return
global b, victory, ans_list
victory = False
ans_list = []
(a, b) = map(int, input().split())
dfs(a)
if victory:
	print('YES')
	ans_list.insert(0, a)
	print(len(ans_list))
	print(*ans_list)
else:
	print('NO')


inp = input().split()
a = inp[0]
b = inp[1]
operation = [b]
while b != a:
	if b != '':
		if int(b) % 2 == 0:
			b = str(int(b) // 2)
		elif b[-1] == '1':
			b = list(b)
			b.pop()
			b = ''.join(b)
		else:
			print('NO')
			break
	else:
		print('NO')
		break
	operation.append(b)
if b == a:
	operation = operation[::-1]
	print('YES')
	print(len(operation))
	print(' '.join(operation))


(n, m) = map(int, input().split())
a = []
a.append(m)
while m > n:
	if m % 10 == 1:
		m //= 10
	elif m % 2 == 0:
		m //= 2
	else:
		break
	a.append(m)
if m == n:
	a.reverse()
	print('YES')
	print(len(a))
	print(*a)
else:
	print('NO')


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt, ceil
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def ds(d):
	for i in range(2, d + 1):
		if d % i == 0:
			return i

def main():
	(a, b) = inlt()
	if a >= b:
		print('NO')
	else:
		res = [str(b)]
		while b > a:
			bstr = str(b)
			if b % 2 == 0:
				b //= 2
				res.append(b)
			elif bstr[-1] == '1' and len(bstr) > 1:
				b = int(bstr[:-1])
				res.append(b)
			else:
				break
		if b == a:
			print('YES')
			print(len(res))
			print(' '.join([str(vvv) for vvv in list(reversed(res))]))
		else:
			print('NO')
main()


def func(n, a, may_be):
	may_be.add(n)
	if n % 10 != 1 and n % 2 == 1 or n < a:
		return
	if n % 10 == 1:
		func(n // 10, a, may_be)
	if n % 2 == 0:
		func(n // 2, a, may_be)
(a, b) = map(int, input().split())
m = set()
func(b, a, m)
if a not in m:
	print('NO')
else:
	print('YES')
	ans = []
	curr = b
	while curr != a:
		ans.append(curr)
		if curr % 10 == 1 and curr // 10 in m:
			curr //= 10
		elif curr % 2 == 0 and curr // 2 in m:
			curr //= 2
	ans.append(a)
	print(len(ans))
	print(' '.join(map(str, ans[::-1])))


(a, b) = map(int, input().split())
queue = []
ind = 0
if b % 2 == 0:
	queue.append([b, 2, []])
if b % 10 == 1:
	queue.append([b, 1, []])
ans = 0
while ind < len(queue) and (not ans):
	start = queue[ind][0]
	opp = queue[ind][1]
	ph = queue[ind][2]
	if opp == 1:
		newStart = (start - 1) // 10
		if newStart != 0:
			if newStart % 2 == 0:
				queue.append([newStart, 2, ph + [start]])
			if newStart % 10 == 1:
				queue.append([newStart, 1, ph + [start]])
	else:
		newStart = start // 2
		if newStart != 0:
			if newStart % 2 == 0:
				queue.append([newStart, 2, ph + [start]])
			if newStart % 10 == 1:
				queue.append([newStart, 1, ph + [start]])
	if newStart == a:
		ans = ph + [start, newStart]
	ind += 1
if ans == 0:
	print('NO')
else:
	print('YES')
	print(len(ans))
	print(' '.join(list(map(str, ans))[::-1]))


def f(a, b, c):
	if (b - 1) % 10 == 0 and (b - 1) / 10 > a:
		return f(a, (b - 1) / 10, str(int(b)) + ' ' + c)
	elif b % 2 == 0 and b / 2 > a:
		return f(a, b / 2, str(int(b)) + ' ' + c)
	elif b / 2 == a or (b - 1) / 10 == a:
		return str(a) + ' ' + str(int(b)) + ' ' + c
	else:
		return False
(a, b) = list(map(int, input().split()))
d = f(a, b, '')
if d == 0:
	print('NO')
else:
	print('YES')
	print(d.count(' '))
	print(d)


(a, b) = map(int, input().split())
flag = 0
ans = [b]
while 1:
	if a == b:
		flag = 1
		break
	elif a > b or (b % 2 != 0 and str(b)[-1] != '1'):
		break
	elif b % 2 == 0:
		b //= 2
		ans.append(b)
	else:
		b = (b - 1) // 10
		ans.append(b)
if flag == 1:
	print('YES')
	print(len(ans))
	ans.reverse()
	print(*ans)
else:
	print('NO')


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(n, dest, stack):
	if n == dest:
		print('YES')
		print(len(stack))
		print(' '.join(list(map(lambda x: str(x), stack))))
		return True
	if n > dest:
		return False
	candi = [n * 2, n * 10 + 1]
	for nextNum in candi:
		if nextNum > dest:
			continue
		newStack = stack[:]
		newStack.append(nextNum)
		if solve(nextNum, dest, newStack) is True:
			return True
	return False

def main():
	firstLine = input().split()
	firstLine = list(map(int, firstLine))
	if solve(firstLine[0], firstLine[1], [firstLine[0]]) is False:
		print('NO')

def log(*message):
	logging.debug(message)
main()


(a, b) = map(int, input().split())
B = 10
X = [b]
while a < b:
	if 1 > 1 & b:
		b >>= 1
	elif 2 > b % B:
		b //= B
	else:
		break
	X.append(b)
if a != b:
	print('NO')
else:
	print('YES')
	print(len(X))
	print(*reversed(X))


(a, b) = list(map(int, input().split()))
nums = []

def f(a, b, numbers):
	global nums
	if a == b:
		nums += [numbers]
	elif a < b:
		f(a * 2, b, numbers + [a * 2])
		f(a * 10 + 1, b, numbers + [a * 10 + 1])
f(a, b, [a])
minn = 0
index = 0
for i in range(len(nums)):
	if len(nums[i]) > minn:
		index = i
		minn = len(nums[i])
if minn == 0:
	print('NO')
else:
	print('YES')
	print(minn)
	for a in nums[i]:
		print(a, end=' ')


import sys
(a, b) = list(map(int, input().split()))

def rec(now, goal, way):
	if now == goal:
		print('YES')
		way.append(now)
		print(len(way))
		print(' '.join(list(map(str, way))))
		sys.exit(0)
	if now > goal:
		return 0
	way.append(now)
	rec(now * 2, goal, way)
	rec(now * 10 + 1, goal, way)
	way.pop()
	return 0
rec(a, b, list())
print('NO')


(a, b) = map(int, input().split())
output = []
num = b
(n1, n2) = (0, 0)
output.append(num)
while num != a:
	if num < a:
		output.clear()
		print('NO')
		exit()
	elif num % 2 == 0:
		num /= 2
		output.append(int(num))
	elif int(num / 10) % 2 == 0:
		num = int(num - 1) / 10
		output.append(int(num))
	else:
		num = int(num - 1) / 10
		output.append(int(num))
output.reverse()
print('YES')
print(len(output))
for i in output:
	print(i, end=' ')


(a1, b1) = input().split()
a = int(a1)
b = int(b1)

def Foo(c):
	if c % 10 == 1:
		return P1(c)
	else:
		return X2(c)

def X2(c):
	return c / 2

def XX2(c):
	return c * 2

def P1(c):
	return (c - 1) / 10

def PP1(c):
	return c * 10 + 1
list_c = [b]
if b % 10 != 1 and b % 2 != 0:
	print('NO')
else:
	while b >= a:
		b = Foo(b)
		list_c.append(b)
		if b == a:
			print('YES')
			print(len(list_c))
			S = ' '
			for i in range(len(list_c)):
				list_c[i] = str(int(list_c[i]))
			print(S.join(list_c[::-1]))
			break
		if b < a:
			print('NO')
		if b % 2 != 0 and b % 10 != 1:
			print('NO')
			break


(a, b) = map(int, input().split())

def solve(a, b):
	arr = []
	while True:
		arr += [b]
		if b == a:
			return (True, arr)
		if b < a:
			return (False, None)
		if b % 10 == 1:
			b = b // 10
		elif b % 2 == 0:
			b = b // 2
		else:
			return (False, None)
(f, a) = solve(a, b)
if not f:
	print('NO')
else:
	print('YES')
	print(len(a))
	for e in reversed(a):
		print(str(e), end=' ')


(a, b) = list(map(int, input().split()))
k = 0
seq = []
while int(b) > a:
	if str(b)[-1] == '1':
		k += 1
		seq.append(b)
		b //= 10
	else:
		k += 1
		seq.append(b)
		if b // 2 != b / 2:
			print('NO')
			quit()
		b //= 2
if int(seq[-1]) // 2 == a or int(seq[-1]) // 10 == a:
	print('YES')
	print(k + 1)
	seq.append(a)
	seq.reverse()
	print(*seq)
else:
	print('NO')


import sys
sys.setrecursionlimit(999999999)
(a, b) = list(map(int, input().split()))
lock = False

def rec(c, d):
	global a, b, lock
	if c > b:
		return 0
	first_d = d.copy()
	second_d = d.copy()
	if not lock:
		if c * 2 == b or 10 * c + 1 == b:
			lock = True
			d.append(b)
			print('YES')
			print(len(d))
			for i in d:
				print(i, ' ', end='')
		first_d.append(c * 2)
		rec(c * 2, first_d)
		second_d.append(10 * c + 1)
		rec(10 * c + 1, second_d)
rec(a, [a])
if not lock:
	print('NO')


(a, b) = list(map(int, input().split()))
queue = [a]
qstart = 0
prev = dict()
prev[a] = -1
while qstart + 1 <= len(queue):
	our = queue[qstart]
	qstart += 1
	if our * 2 <= 10 ** 9 and our * 2 not in prev:
		queue.append(our * 2)
		prev[our * 2] = our
	t = our * 10 + 1
	if t <= 10 ** 9 and t not in prev:
		queue.append(t)
		prev[t] = our
if b in prev:
	print('YES')
	res = []
	curr = b
	while curr != -1:
		res.append(curr)
		curr = prev[curr]
	print(len(res))
	print(' '.join(map(str, res[::-1])))
else:
	print('NO')


(a, b) = map(int, input().split())
X = [b]
while a < b:
	if b % 2:
		(b, m) = divmod(b, 10)
		if m != 1:
			print('NO')
			break
		X.append(b)
	else:
		b //= 2
		X.append(b)
else:
	if a != b:
		print('NO')
	else:
		print('YES')
		print(len(X))
		print(*reversed(X))


from collections import deque
(a, b) = map(int, input().split(' '))
pre = {}
fila = deque([a])
while fila:
	v = fila.popleft()
	if 2 * v not in pre and 2 * v <= b:
		fila.append(2 * v)
		pre[2 * v] = v
	if 10 * v + 1 not in pre and 10 * v + 1 <= b:
		fila.append(10 * v + 1)
		pre[10 * v + 1] = v
seq = [b]
if b not in pre:
	print('NO')
else:
	print('YES')
	x = b
	while x != a:
		x = pre[x]
		seq.append(x)
	print(len(seq))
	seq.reverse()
	print(*seq)


(a, b) = map(int, input().split())
d = b
c = b % 10
if c % 2 != 0 and c != 1:
	print('NO')
else:
	l = []
	if c == 1:
		b = b - 1
		b //= 10
		l.append(b)
	else:
		b //= 2
		l.append(b)
	while b > a:
		if b % 2 != 0 and b % 10 != 1:
			print('NO')
			exit()
		if b % 10 == 1:
			b -= 1
			b //= 10
		else:
			b //= 2
		l.append(b)
	if b != a:
		print('NO')
	else:
		print('YES')
		print(len(l) + 1)
		s = ''
		for i in range(len(l) - 1, -1, -1):
			s += str(l[i])
			s += ' '
		s += str(d)
		print(s)


(a, b) = map(int, input().split())
r = [b]
while b > a:
	d = b % 10
	if d == 1:
		b //= 10
	elif d % 2:
		break
	else:
		b //= 2
	r += [b]
r = r[::-1]
print([f"YES\n{len(r)}\n{' '.join(map(str, r))}", 'NO'][a != b])


import sys

def inp():
	return int(input())

def linp():
	return map(int, input().split())
(a, b) = linp()
li = []
li.append(b)
cnt = 1
while b > a:
	if b % 10 == 1:
		b //= 10
		cnt += 1
		li.append(b)
	else:
		if b % 2 != 0:
			print('NO')
			exit()
		b //= 2
		cnt += 1
		li.append(b)
if b == a:
	print('YES')
	print(cnt)
	li.reverse()
	print(*li)
else:
	print('NO')


(a, b) = map(int, input().split())
l = []
ans = []

def f(a, s):
	global ans, b
	if s[-1] == b:
		ans = s[:]
	elif a > b:
		pass
	else:
		f(a * 2, s + [a * 2])
		f(a * 10 + 1, s + [a * 10 + 1])
f(a, [a])
if not ans:
	print('NO')
else:
	print('YES')
	print(len(ans))
	print(' '.join(map(str, ans)))


(a, b) = map(int, input().split())
res = [b]
while b > a:
	if b % 2 == 0:
		b = b // 2
		res.append(b)
	elif b % 10 == 1:
		b = b // 10
		res.append(b)
	else:
		break
if b == a:
	res.sort()
	print('YES')
	print(len(res))
	for i in res:
		print(i, end=' ')
else:
	print('NO')


def solve(a, b):
	x = []
	while b > a:
		x += [b]
		if b % 2 == 0:
			b //= 2
		elif b % 10 == 1:
			b //= 10
		else:
			return []
	if b < a:
		return []
	return x + [a]
x = solve(*map(int, input().split()))
if x == []:
	print('NO')
else:
	print('YES')
	print(len(x))
	print(*reversed(x))


def solve(x, y):
	if x > y:
		return []
	if x == y:
		return [x]
	temp = solve(x * 2, y)
	if len(temp) != 0:
		temp.insert(0, x)
		return temp
	temp = solve(10 * x + 1, y)
	if len(temp) != 0:
		temp.insert(0, x)
		return temp
	return []
(x, y) = map(int, input().split())
temp = solve(x, y)
if len(temp) == 0:
	print('NO')
else:
	print('YES')
	print(len(temp))
	for i in temp:
		print(i)


(a, b) = map(int, input().split())
done = set()
gf = False
pq = []

def rc(x, q):
	x = str(x)
	if len(x) < len(str(a)):
		return
	global gf, pq, done
	if int(x) == a:
		gf = True
		pq = q
		return
	if gf == True:
		return
	q.append(x)
	if x in done:
		return
	if x[-1] == '1':
		rc(x[:-1], q)
	if int(x) % 2 == 0:
		rc(int(x) // 2, q)
	done.add(x)
rc(str(b), [])
if gf:
	print('YES')
	print(len(pq) + 1)
	print(a, ' '.join(pq[::-1]))
else:
	print('NO')


(a, b) = [int(x) for x in input().split()]
ans = [b]
while b > a:
	if b % 2 == 1 and str(b)[-1] != '1':
		print('NO')
		break
	if b % 2 == 1 and str(b)[-1] == '1':
		b = b // 10
		ans.append(b)
		continue
	if b % 2 == 0:
		b = b // 2
		ans.append(b)
		continue
else:
	if b != a:
		print('NO')
	else:
		print('YES')
		print(len(ans))
		for i in range(len(ans)):
			print(ans[len(ans) - i - 1], end=' ')


line = input().split()
a = int(line[0])
b = int(line[1])
travel = []
travel.append([])
q = [a]
index = 0
q = [b]
while b > a:
	if b % 2 == 0:
		b = int(b / 2)
		q += [b]
	elif b % 10 == 1:
		b = int(b / 10)
		q += [b]
	else:
		break
q.reverse()
if a == b:
	print('YES', len(q), sep='\n')
	for i in q:
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
l = []
flag = 0
while True:
	if b == a:
		flag = 1
		l.append(b)
		break
	if b < a:
		break
	if b % 2 == 0:
		l.append(b)
		b //= 2
		continue
	if b % 10 == 1:
		l.append(b)
		b //= 10
		continue
	if b % 10 != 1 and b % 2 == 1:
		break
l.reverse()
if flag == 1:
	print('YES')
	print(len(l))
	for j in range(len(l)):
		if j == len(l) - 1:
			print(l[j])
		else:
			print(l[j], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split(' '))
l = []

def t(a, b):
	if b == a:
		l.insert(0, b)
		print('YES')
		print(len(l))
		print(' '.join(map(str, l)))
		return
	if b < a:
		print('NO')
		return
	if b % 2 == 0:
		l.insert(0, b)
		return t(a, b // 2)
	if b % 10 == 1:
		l.insert(0, b)
		return t(a, b // 10)
	print('NO')
	return
t(a, b)


def f(a, b, L):
	if a == b:
		return (True, L)
	elif a > b:
		return (False, L)
	else:
		J = L + [2 * a]
		K = L + [10 * a + 1]
		(good1, M) = f(2 * a, b, J)
		(good2, N) = f(10 * a + 1, b, K)
		if good1:
			return (True, M)
		elif good2:
			return (True, N)
		else:
			return (False, L)

def run():
	i = 0
	for line in iter(input, ''):
		if i == 0:
			k = line.split(' ')
			(a, b) = (int(k[0]), int(k[1]))
			break
	(good, L) = f(a, b, [a])
	if L != [a]:
		print('YES')
		print(len(L))
		for c in L:
			print(c, end=' ')
	else:
		print('NO')
run()


raw_input_string = input()
input_string = raw_input_string.split(' ')
start = int(input_string[0])
end = int(input_string[1])
lastnum = end
my_bool = True
steps = []
steps.append(end)
while lastnum > start:
	if lastnum % 2 == 0:
		lastnum //= 2
		steps.append(lastnum)
	elif str(lastnum).endswith('1'):
		lastnum -= 1
		lastnum //= 10
		steps.append(lastnum)
	else:
		my_bool = False
		break
if lastnum == start:
	my_bool = True
else:
	my_bool = False
if my_bool:
	step_string = ''
	print('YES')
	print(len(steps))
	steps.reverse()
	for step in steps:
		step_string = step_string + str(step) + ' '
	print(step_string.strip(' '))
else:
	print('NO')


from collections import deque
(a, b) = map(int, input().split())
pre = {}
queue = deque([a])
while queue:
	v = queue.popleft()
	if 2 * v not in pre and 2 * v <= b:
		queue.append(2 * v)
		pre[2 * v] = v
	if 10 * v + 1 not in pre and 10 * v + 1 <= b:
		queue.append(10 * v + 1)
		pre[10 * v + 1] = v
seq = [b]
if b not in pre:
	print('NO')
else:
	print('YES')
	x = b
	while x != a:
		x = pre[x]
		seq.append(x)
	print(len(seq))
	out = []
	for i in seq[::-1]:
		out.append(str(i))
	print(' '.join(out))


(a, b) = map(int, input().split())
lst = []
while b > a:
	lst.append(b)
	if str(b)[-1] == '1':
		b = int(str(b)[:-1])
	elif b % 2 == 0:
		b //= 2
	else:
		print('NO')
		exit()
lst.append(a)
if b == a:
	print('YES')
	print(len(lst))
	print(*lst[::-1])
else:
	print('NO')


(a, b) = map(int, input().split())
k = 1
numbers = str(b)
while a < b:
	if b % 2 == 0:
		b = b / 2
		k += 1
		numbers = str(int(b)) + ' ' + numbers
	elif b % 10 == 1:
		b = b // 10
		k += 1
		numbers = str(int(b)) + ' ' + numbers
	else:
		b = 0
if a == b:
	print('YES')
	print(k)
	print(numbers)
else:
	print('NO')


(a, b) = (int(i) for i in input().split())
if b < a:
	print('NO')
	exit(0)
ans = 0
ans_l = [b]
while b > a:
	if b % 2 == 0 and b / 2 >= a:
		ans += 1
		b //= 2
		ans_l += [b]
	elif b % 10 == 1 and b // 10 >= a:
		ans += 1
		b //= 10
		ans_l += [b]
	else:
		print('NO')
		exit(0)
print('YES')
print(ans + 1)
print(' '.join(list(map(str, ans_l[::-1]))))


def work(x):
	if x > a:
		if x % 2 == 0:
			t = work(x // 2)
			if t < 0:
				return -1
			f[x] = x // 2
			return t + 1
		elif x % 10 == 1:
			t = work(x // 10)
			if t < 0:
				return -1
			f[x] = x // 10
			return t + 1
		else:
			return -1
	elif x == a:
		return 0
	else:
		return -1

def printf(x):
	if x != a:
		printf(f[x])
	if x != b:
		print(x, end=' ')
	else:
		print(x, end='\n')
	return
(a, b) = input().split(' ')
a = int(a)
b = int(b)
f = {}
ans = work(b)
if ans < 0:
	print('NO')
else:
	print('YES')
	print(ans + 1)
	printf(b)


(a, b) = input().split()
s = []
s.append(b)
while 1:
	if int(b[-1]) != 1 and int(b) % 2 != 0:
		print('NO')
		break
	u = 0
	while True:
		if len(b) != 0 and b[-1] == '1' and (int(a) < int(b)):
			b = list(b)
			del b[-1]
			b = ''.join(b)
			s.append(b)
		elif len(b) != 0 and int(b) % 2 == 0 and (a != b) and (len(b) != 0) and (int(a) < int(b)):
			b = str(int(int(b) / 2))
			s.append(b)
		elif b == a:
			s.append(a)
			break
		elif len(b) != 0:
			u += 1
			break
		elif len(b) == 0:
			break
		elif a == b:
			break
		elif len(b) != 0 and a != b:
			u += 1
			break
		elif a == b:
			break
	del s[-1]
	s.reverse()
	if u:
		print('NO')
		break
	else:
		print('YES')
		print(len(s))
		print(*s)
		break


import math
(end, init) = input().split()
end = int(end)
init = int(init)
count = 0
lst = []
finish = False
lst.append(init)
while init != end:
	if init % 2 == 0:
		init = int(init / 2)
		lst.append(init)
	elif (init - 1) % 10 == 0:
		init = int(init - 1)
		init = math.floor(init // 10)
		init = init
		lst.append(init)
	else:
		break
	if init == end:
		finish = True
	if init < end:
		break
if finish:
	print('YES')
	print(len(lst))
	lst.reverse()
	for i in lst:
		print(i, end=' ')
else:
	print('NO')


def ab():
	if a[0] > b:
		return
	if a[0] == b:
		print('YES')
		print(len(res))
		for r in res:
			print(r, end=' ')
		print()
		found[0] = True
		return
	a[0] *= 2
	res.append(a[0])
	ab()
	if found[0]:
		return
	res.pop()
	a[0] //= 2
	a[0] = 10 * a[0] + 1
	res.append(a[0])
	ab()
	if found[0]:
		return
	res.pop()
	a[0] = (a[0] - 1) // 10
(al, b) = [int(x) for x in input().split()]
res = []
res.append(al)
found = [False]
a = [al]
ab()
if not found[0]:
	print('NO')


(a, b) = map(int, input('').split())
oplst = []
oplst.append(b)
for i in range(b):
	if b % 10 == 1:
		b = b // 10
		oplst.append(b)
		if b == a:
			print('YES')
			print(len(oplst))
			oplst.reverse()
			print(*oplst, sep=' ')
			break
		elif b < a:
			print('NO')
			break
	elif b % 2 == 0:
		b = b // 2
		oplst.append(b)
		if b == a:
			print('YES')
			print(len(oplst))
			oplst.reverse()
			print(*oplst, sep=' ')
			break
		elif b < a:
			print('NO')
			break
	else:
		print('NO')
		break


(a, b) = map(int, input().split())
r = [b]
while b > a:
	if b % 2 == 0:
		b = b // 2
	elif str(b)[-1] == '1':
		b = int(str(b)[:-1])
	else:
		print('NO')
		break
	r.append(b)
else:
	if b == a:
		print('YES')
		print(len(r))
		print(*r[::-1])
	else:
		print('NO')


(a, b) = map(int, input().split())
l = [b]
while a < b:
	if b % 2:
		b -= 1
		if b % 10 == 0:
			b //= 10
		else:
			exit(print('NO'))
	else:
		b //= 2
	l += [b]
if b < a:
	print('NO')
else:
	print('YES\n', len(l), '\n', *l[::-1])


(a, b) = map(int, input().split())

def transformation(a, b, path):
	if a == b:
		return path
	if a < b:
		a1 = int(str(10 * a)) + 1
		a2 = 2 * a
		res1 = transformation(a1, b, path[:] + [a1])
		res2 = transformation(a2, b, path[:] + [a2])
		if res1 and res1[-1] == b:
			return res1
		if res2 and res2[-1] == b:
			return res2
	return []
ans = list(map(str, transformation(a, b, [a])))
if not ans:
	print('NO')
else:
	print('YES')
	print(len(ans))
	print(' '.join(ans))


numbers = list(map(int, input().split()))
list = []
k = 1
list.append(numbers[1])
while numbers[0] != numbers[1]:
	if numbers[1] % 10 == 1:
		numbers[1] = numbers[1] // 10
		list.append(numbers[1])
		k += 1
	elif numbers[1] % 2 == 0 and numbers[1] != 0:
		numbers[1] = numbers[1] // 2
		list.append(numbers[1])
		k += 1
	else:
		break
if numbers[0] == numbers[1]:
	print('YES')
	print(k)
	print(*list[::-1])
else:
	print('NO')


def canoperate(n):
	return str(n)[-1] == '1' and str(n) != '1' or n % 2 == 0

def operate(n):
	if n % 2 == 0:
		return n // 2
	else:
		return (n - 1) // 10
(a, b) = map(int, input().split())
res = [b]
while canoperate(b):
	b = operate(b)
	res.append(b)
	if b == a:
		print('YES')
		print(len(res))
		print(*res[::-1])
		break
else:
	print('NO')


(a, b) = input().split()
(a, b) = (int(a), int(b))

def tr(x, y, res=None):
	if res is None:
		res = []
	res.insert(0, y)
	if res[0] == x:
		return (True, res)
	if y < x:
		return (False, res)
	if y % 10 == 1:
		return tr(x, y // 10, res)
	elif y % 2 == 0:
		return tr(x, y // 2, res)
	else:
		return (False, res)
(boo, lst) = tr(a, b)
if boo:
	print('YES')
	print(len(lst))
	for i in lst:
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
c = str
d = 0
h = []
h.append(b)
while b > a:
	if b % 2 == 0:
		b = b // 2
		h.append(b)
	elif b % 10 == 1:
		b = b // 10
		h.append(b)
	else:
		break
h.reverse()
if a == b:
	print('YES')
	print(len(h))
	for i in range(len(h)):
		print(h[i], end=' ')
else:
	print('NO')


def convert(a, b):
	path = [b]
	while b != a:
		if b % 2 == 0 and b > 0:
			b //= 2
			path.append(b)
		elif b % 10 == 1:
			b //= 10
			path.append(b)
		else:
			return None
	return reversed(path)

def main():
	ans = convert(*list(map(int, input().split())))
	if ans is None:
		print('NO')
	else:
		print('YES')
		path = list(ans)
		print(len(path))
		print(*path)

def __starting_point():
	main()
__starting_point()


(a, b) = map(int, input().split())
l = []
while b > a:
	l.append(b)
	if b % 2 == 0:
		b /= 2
	else:
		b -= 1
		b /= 10
if b < a:
	print('NO')
else:
	print('YES\n%d' % (len(l) + 1))
	print(a, end=' ')
	for i in range(len(l) - 1, 0, -1):
		print(int(l[i]), end=' ')
	print(int(l[0]))


import math
from math import gcd, floor, sqrt, log

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

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

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

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

def ceill(x):
	return int(x) if x == int(x) else int(x) + 1

def ceilldiv(x, d):
	x // d if x % d == 0 else x // d + 1

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

def solve():
	(a, b) = listin()
	temp = [b]
	while b >= a:
		if b == a:
			break
		if str(b)[-1] == '1':
			b = int(str(b)[:len(str(b)) - 1])
			temp.append(b)
		elif b % 2 == 0:
			b //= 2
			temp.append(b)
		else:
			print('NO')
			return
	if b == a:
		print('YES')
		print(len(temp))
		for i in range(len(temp) - 1, -1, -1):
			print(temp[i], end=' ')
	else:
		print('NO')
t = 1
for hula in range(t):
	solve()


(b, a) = list(map(int, input().split()))
a1 = a
l = [a]
while a > b:
	if a % 2 == 1:
		if (a - 1) % 10 != 0:
			break
		a = (a - 1) // 10
		l += [a]
	else:
		a = a // 2
		l += [a]
if a == b:
	print('YES')
	print(len(l))
	r = list(reversed(l))
	print(' '.join(map(str, r)))
else:
	print('NO')


s = input().split(' ')
a = int(s[0])
b = int(s[1])
c = b
d = int(0)
k = int(1)
i = int()
m = [b] * 1
while d == 0 and c > a:
	if c % 10 == 1:
		c = c // 10
		m.append(c)
		k = k + 1
	elif c % 2 == 1:
		d = 1
	else:
		c = c // 2
		m.append(c)
		k = k + 1
if c == a:
	m = m[::-1]
	print('YES')
	print(k)
	for i in range(0, len(m), 1):
		print(m[i], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
pre = {}
f = [a]
while f:
	v = f.pop(0)
	if 2 * v not in pre and 2 * v <= b:
		f.append(2 * v)
		pre[2 * v] = v
	if 10 * v + 1 not in pre and 10 * v + 1 <= b:
		f.append(10 * v + 1)
		pre[10 * v + 1] = v
sq = [b]
if b not in pre:
	print('NO')
else:
	print('YES')
	x = b
	while x != a:
		x = pre[x]
		sq.append(x)
	print(len(sq))
	for i in sq[::-1]:
		print(i, end=' ')
	print()


def f(t):
	u = t[0]
	if u == a:
		print('YES', len(t), sep='\n')
		print(*t)
		raise TabError
	if u > a:
		if u % 10 == 1:
			f((u // 10, *t))
		if not u % 2:
			f((u // 2, *t))
(a, b) = map(int, input().split())
try:
	f((b,))
except:
	pass
else:
	print('NO')


def create(x, w):
	if x > b:
		return [0]
	if x == b:
		return w + [x]
	k = create(2 * x, w + [x])
	p = create(10 * x + 1, w + [x])
	if k[-1] > 0:
		return k
	elif p[-1] > 0:
		return p
	else:
		return [0]
(a, b) = map(int, input().split())
ans = create(a, [])
if ans[-1] != 0:
	print('YES')
	print(len(ans))
	print(*ans)
else:
	print('NO')


(a, b) = map(int, input().split())
s = []
while b > a:
	s.append(b)
	if b % 2 == 0:
		b //= 2
	elif b % 10 == 1:
		b //= 10
	else:
		print('NO')
		exit()
if b == a:
	s.append(b)
	s.reverse()
	print('YES')
	print(len(s))
	print(*s)
else:
	print('NO')


(a, b) = map(int, input().split())
aux = []
aux.append(b)
while b > 0:
	if b % 2 == 0:
		b /= 2
		aux.append(b)
	elif (b - 1) % 10 == 0:
		b -= 1
		b /= 10
		aux.append(b)
	else:
		break
	if b == a:
		break
if aux[len(aux) - 1] == a:
	print('YES')
	print(len(aux))
	size = len(aux)
	for i in range(size - 1, -1, -1):
		print(int(aux[i]), end=' ')
else:
	print('NO')


line = input().split()
a = int(line[0])
b = int(line[1])
travel = []
travel.append([])
q = [a]
index = 0
while len(q) > 0:
	temp = q[0] * 2
	if temp <= b and index < len(travel):
		q += [temp]
		travel.append([])
		travel[len(travel) - 1] = list(travel[index])
		travel[len(travel) - 1] += [q[0]]
		if temp == b:
			print('YES', len(travel[len(travel) - 1]) + 1, sep='\n')
			for i in travel[len(travel) - 1]:
				print(i, end=' ')
			print(temp)
			break
	temp = q[0] * 10 + 1
	if temp <= b and index < len(travel):
		q += [temp]
		travel.append([])
		travel[len(travel) - 1] = list(travel[index])
		travel[len(travel) - 1] += [q[0]]
		if temp == b:
			print('YES', len(travel[len(travel) - 1]) + 1, sep='\n')
			for i in travel[len(travel) - 1]:
				print(i, end=' ')
			print(temp)
			break
	q.pop(0)
	index += 1
	if len(q) == 0:
		print('NO')


visited = {}

def solve(a, b):
	if a > b:
		return
	if a in visited:
		return
	visited[a] = 1
	solve(2 * a, b)
	solve(10 * a + 1, b)
(a, b) = map(int, input().split())
solve(a, b)
if b in visited:
	print('YES')
	res = [b]
	while b > a:
		if b % 2 == 0:
			b //= 2
		else:
			b = (b - 1) // 10
		res.append(b)
	print(len(res))
	print(' '.join(map(str, res[::-1])))
else:
	print('NO')


(a, b) = map(int, input().split())
line = [b]
res = 1
while b != a:
	if b > a:
		if b % 2 == 0:
			b //= 2
			line.append(b)
		elif b % 10 == 1:
			b //= 10
			line.append(b)
		else:
			res = 0
			break
	else:
		break
if a == b:
	print('YES')
	print(len(line))
	line = line[::-1]
	print(*line)
else:
	print('NO')


(a, b) = map(int, input().split())
ans = []
while b > a and (b % 10 == 1 or b % 2 == 0):
	ans.insert(0, b)
	if b % 10 == 1:
		b //= 10
	else:
		b //= 2
if a == b:
	print('YES')
	print(1 + len(ans))
	print(a, end=' ')
	print(*ans)
else:
	print('NO')


import sys
(a, b) = [int(x) for x in input().split()]
r = []
r.append(b)
if b & 1:
	b -= 1
	if b % 10 != 0:
		print('NO')
		sys.exit(0)
	else:
		b = b // 10
		r.append(b)
while b != 0:
	if b < a:
		break
	if b == a:
		break
	if b & 1:
		b -= 1
		if b % 10 != 0:
			print('NO')
			sys.exit(0)
		b = b // 10
	else:
		b = b // 2
	r.append(b)
if b == a:
	print('YES')
	print(len(r))
	r = sorted(r)
	for x in range(len(r)):
		print(r[x], end=' ')
else:
	print('NO')


from sys import stdin, stdout
import bisect
import math
from collections import deque
mod = 10 ** 9 + 7

def st():
	return list(stdin.readline().strip())

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

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

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

def pr(n):
	stdout.write(str(n) + '\n')

def DFS(d, i, visited):
	visited[i] = True
	stack = [i]
	while stack:
		a = stack.pop()
		for i in d[a]:
			if not visited[i]:
				visited[i] = True
				stack.append(i)

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def valid(a, b, l):
	if a > b:
		return False
	if a == b:
		l.append(a)
		return True
	if valid(2 * a, b, l):
		l.append(a)
		return True
	if valid(10 * a + 1, b, l):
		l.append(a)
		return True
	return False

def solve():
	(a, b) = mp()
	l = []
	if valid(a, b, l):
		print('YES')
		print(len(l))
		l = l[::-1]
		print(*l)
	else:
		print('NO')
for _ in range(1):
	solve()


(a, b) = map(int, input().split())
L = [b]
while a < b:
	if b % 2 == 0:
		b //= 2
		L.append(b)
	elif b % 10 == 1:
		b //= 10
		L.append(b)
	else:
		break
if a == b:
	print('YES')
	print(len(L))
	L.reverse()
	print(*L)
else:
	print('NO')


def multiple(a, b, seq):
	if a == b:
		return seq + [a]
	if a > b:
		return []
	if a < b:
		return multiple(a * 2, b, seq + [a]) or multiple(a * 10 + 1, b, seq + [a])
(a, b) = map(int, input().split(' '))
res = multiple(a, b, [])
if len(res) == 0:
	print('NO')
else:
	print('YES', len(res), sep='\n')
	print(*res)


(a, b) = list(map(int, input().split()))
ans = []
fl = False
ans.append(b)
while b > a:
	if b % 2 == 0:
		b //= 2
		ans.append(b)
	elif b % 10 == 1:
		b //= 10
		ans.append(b)
	else:
		fl = True
		print('NO')
		break
if not fl and b == a:
	print('YES')
	print(len(ans))
	print(*ans[::-1])
elif not fl:
	print('NO')


(a, b) = map(int, input().split())
cnt = 1
op = [b]
while b > a:
	if b % 10 == 1:
		b //= 10
		cnt += 1
		op.append(b)
	elif b % 10 % 2 == 0:
		b //= 2
		cnt += 1
		op.append(b)
	else:
		print('NO')
		exit()
if b < a:
	print('NO')
else:
	print('YES')
	print(cnt)
	print(' '.join(map(str, op[::-1])))


A = input().split()
a = int(A[0])
b = int(A[1])
s = 1
B = []

def trans(a, b):
	global B, s
	if a > b:
		return 'NO'
	elif a == b:
		return 'YES'
	elif trans(a * 2, b) == 'YES':
		s += 1
		B.append(a * 2)
		return 'YES'
	elif trans(10 * a + 1, b) == 'YES':
		s += 1
		B.append(a * 10 + 1)
		return 'YES'
	else:
		return '&&'

def tr(a, b):
	global B, s
	if a > b:
		return 'NO'
	elif a == b:
		return 'YES'
	else:
		o = tr(2 * a, b)
		d = tr(10 * a + 1, b)
		if o == 'YES':
			B.append(2 * a)
			s += 1
			return 'YES'
		elif d == 'YES':
			B.append(10 * a + 1)
			s += 1
			return 'YES'
		else:
			return 'NO'
res = tr(a, b)
B.append(a)
R = []
for i in range(len(B)):
	R.append(B[len(B) - 1 - i])
print(res)
if res == 'YES':
	print(s)
	for i in range(len(R) - 1):
		print(R[i], end=' ')
	print(R[len(R) - 1])


def gen(a, b):
	global k, ans
	if a == b:
		print('YES')
		print(k)
		print(' '.join(map(str, ans[::-1])))
	elif b % 2 == 0 and a < b:
		b //= 2
		ans.append(b)
		k += 1
		gen(a, b)
	elif b % 10 == 1 and a < b:
		b = (b - 1) // 10
		ans.append(b)
		k += 1
		gen(a, b)
	else:
		print('NO')
(a, b) = map(int, input().split())
ans = [b]
k = 1
gen(a, b)


(a, b) = map(int, input().split())
f = 0
l = [b]
while b > a:
	if b % 2 == 1 and b % 10 != 1:
		f = 1
		print('NO')
		break
	elif b % 10 == 1:
		b = (b - 1) // 10
		l.insert(0, b)
	else:
		b = b // 2
		l.insert(0, b)
if f == 0 and b == a:
	print('YES')
	print(len(l))
	print(*l)
elif f == 0:
	print('NO')


(a, b) = list(map(int, input().split()))
l = []
l.append(b)
while b > a:
	if b % 2 == 0 and b > 0:
		b = b // 2
		l.append(b)
	elif b % 10 == 1:
		b = b // 10
		l.append(b)
	else:
		break
if l[-1] == a:
	print('YES')
	l = list(map(str, l))
	print(len(l))
	l.reverse()
	print(' '.join(l))
else:
	print('NO')


(a, b) = map(int, input().split())
c = []
found = False
while True:
	c.append(b)
	if b == a:
		found = True
		break
	if b < a:
		break
	if b % 10 == 1:
		b = b // 10
	elif b % 2 == 0:
		b = b // 2
	else:
		break
if not found:
	print('NO')
else:
	print('YES')
	print(str(len(c)))
	st = ' '.join(list(map(str, c[::-1])))
	print(st)


(a, b) = map(int, input().split())
c = []

def search(a, b, c):
	if a > b:
		result = False
	elif a == b:
		result = True
	else:
		a1 = 2 * a
		result = search(a1, b, c)
		if result == False:
			a1 = 10 * a + 1
			result = search(a1, b, c)
		if result == True:
			c.append(a1)
	return result
if search(a, b, c) == False:
	print('NO')
else:
	c.append(a)
	c.reverse()
	print('YES')
	print(len(c))
	print(*c)


a = input()
s = a.split()
a = int(s[0])
b = int(s[1])
sp = [b]
k = 1
c = True
while a != b and c == True:
	if b % 10 == 1:
		b = (b - 1) / 10
		sp.append(int(b))
		k = k + 1
	else:
		b = b / 2
		sp.append(int(b))
		k = k + 1
	if a > b:
		c = False
sp.reverse()
if c == True:
	print('YES')
	print(k)
	print(*sp)
if c == False:
	print('NO')


v = []
(a, b) = map(int, input().split())

def fuck(x):
	if x > b:
		return
	v.append(x)
	if x == b:
		print('YES')
		print(len(v))
		for z in v:
			print(z, end=' ')
		exit(0)
	fuck(2 * x)
	fuck(10 * x + 1)
	v.pop()
fuck(a)
print('NO')


from collections import deque
import sys
sys.setrecursionlimit(5000)

class dfs_result:

	def __init__(self):
		self.parent = {}
		self.finish_time = {}
		self.start_time = {}
		self.edges = {}
		self.order = []
		self.t = 0
		self.found = False

def adj_list(v):
	l = []
	l.append(v * 10 + 1)
	l.append(2 * v)
	return l

def dfs_visit(v, result, dest, parent=None):
	result.parent[v] = parent
	result.t += 1
	result.start_time[v] = result.t
	if v == dest:
		result.found = True
	if parent:
		result.edges[parent, v] = 'tree'
	if result.found or v > dest:
		return
	else:
		for n in adj_list(v):
			if n not in result.parent:
				dfs_visit(n, result, dest, v)
			elif n not in result.finish_time:
				if (n, v) not in result.edges:
					result.edges[v, n] = 'back'
					result.loop = [v, n]
			elif result.start_time[v] < result.finish_time[n]:
				result.edges[v, n] = 'forward'
			else:
				result.edges[v, n] = 'cross'
		result.t += 1
		result.finish_time[v] = result.t
		result.order.append(v)
(s, d) = list(map(int, input().rstrip().split()))
r = dfs_result()
dfs_visit(s, r, d)
ans = []
if r.found:
	print('YES')
	ans.append(d)
	while r.parent[d] != s:
		ans.append(r.parent[d])
		d = r.parent[d]
	ans.append(s)
	print(len(ans))
	for i in range(len(ans) - 1, -1, -1):
		print(ans[i], end=' ')
else:
	print('NO')


(a, b) = list(map(int, input().split()))
arr = [str(b)]
while b > a:
	if b % 10 == 1:
		b //= 10
		arr.append(str(b))
	elif b % 2 == 0:
		b //= 2
		arr.append(str(b))
	else:
		b = -1
if b == a:
	arr.reverse()
	print('YES', len(arr), ' '.join(arr), sep='\n')
else:
	print('NO')


def print_path(dic, b, a):
	if b not in dic:
		print('NO')
	else:
		print('YES')
		path = [b]
		while b != a:
			b = dic[b]
			path.append(b)
		print(len(path))
		from sys import stdout
		[stdout.write(str(p) + ' ') for p in path[::-1]]
		print()

def transform(a, b):
	pre = dict()
	q = [a]
	while q:
		v = q.pop(0)
		if 2 * v not in pre and 2 * v <= b:
			q.append(2 * v)
			pre[2 * v] = v
		if 10 * v + 1 not in pre and 10 * v + 1 <= b:
			q.append(10 * v + 1)
			pre[10 * v + 1] = v
	return pre
(a, b) = [int(x) for x in input().split(' ')]
result = transform(a, b)
print_path(result, b, a)


(a, b) = map(int, input().split())
arr = [b]
val = 1
while b > a:
	if b % 2 == 0:
		b = b // 2
		arr.append(b)
		val += 1
	elif (b - 1) % 10 == 0:
		b = (b - 1) // 10
		arr.append(b)
		val += 1
	else:
		break
if a == b:
	print('YES')
	print(val)
	for i in arr[::-1]:
		print(i)
else:
	print('NO')


rez = 'NO'
ms = []

def gen(a, b, mas):
	nonlocal rez, ms
	if a == b:
		rez = 'YES'
		ms = mas[:]
	elif a < b:
		gen(a * 2, b, mas + [a * 2])
		gen(a * 10 + 1, b, mas + [a * 10 + 1])
(a, b) = list(map(int, input().split()))
gen(a, b, [a])
if rez == 'YES':
	print(rez)
	print(len(ms))
	print(*ms)
else:
	print(rez)


def hi(n):
	return 2 * n

def hd(n):
	return 10 * n + 1

def dfs(a, b, p):
	f = False
	if a == b:
		f = True
		p.append(a)
	elif a < b:
		f = dfs(hi(a), b, p)
		if not f:
			f = dfs(hd(a), b, p)
		if f:
			p.append(a)
	return f
(a, b) = [int(x) for x in input().split(' ')]
p = []
f = dfs(a, b, p)
if f:
	print('YES')
	print(len(p))
	print(' '.join(map(str, reversed(p))))
else:
	print('NO')


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
from math import ceil, floor, log, sqrt, factorial, pow, pi

def ii():
	return int(input())

def si():
	return str(input())

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph():
	d = {}
	(v, e) = mi()
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d
(x, y) = mi()
y = str(y)
z = y
ans = 'NO'
out = []
while x <= int(y):
	if y[-1] == '1':
		y = y[:-1]
	elif int(y) % 2 == 0:
		y = str(int(y) // 2)
	else:
		break
	if x == int(y):
		ans = 'YES'
		break
	out.append(y)
print(ans)
if ans == 'YES':
	out.append(str(x))
	out = out[::-1]
	out.append(z)
	print(len(out))
	print(' '.join(out))


from collections import deque
(a, b) = map(int, input().split())
num = b
ans = deque()
cnt = 0
while num > a:
	if not num % 2:
		ans.appendleft(num)
		cnt += 1
		num //= 2
	elif str(num)[-1] == '1':
		ans.appendleft(num)
		cnt += 1
		num = int(str(num)[:-1])
	else:
		print('NO')
		exit()
if num == a:
	ans.appendleft(num)
	cnt += 1
if num not in ans:
	print('NO')
	exit()
print('YES')
print(cnt)
print(*ans)


def do1(x):
	return x * 2

def do2(x):
	return x * 10 + 1

def recurs(b, now, nowlist):
	if now > b:
		return None
	nowlist.append(now)
	if now == b:
		return nowlist
	nowlist1 = recurs(b, do2(now), nowlist)
	if nowlist1 is not None:
		return nowlist1
	nowlist2 = recurs(b, do1(now), nowlist)
	if nowlist2 is not None:
		return nowlist2
	nowlist.remove(now)
numbers = input().split()
a = int(numbers[0])
b = int(numbers[1])
answer = recurs(b, a, list())
if answer is None:
	print('NO')
else:
	print('YES')
	print(len(answer))
	print(' '.join([str(i) for i in answer]))


def run(num, t):
	path = t[:]
	newA = 2 * num
	newAA = 10 * num + 1
	if newA < b:
		run(newA, path + [newA])
	elif newA == b:
		ans.append(path + [newA])
	if newAA < b:
		run(newAA, path + [newAA])
	elif newAA == b:
		ans.append(path + [newAA])
temp = []
ans = []
(a, b) = map(int, input().split())
temp.append(a)
run(a, temp)
if len(ans) > 0:
	ans = sorted(ans, key=lambda x: len(x))
	print('YES')
	print(len(ans[0]))
	print(*ans[0])
else:
	print('NO')


(a, b) = map(int, input().split())
l = [b]
while True:
	if a == b:
		lenl = len(l)
		print('YES', lenl, a, sep='\n', end=' ')
		for i in range(lenl - 2, -1, -1):
			print(l[i], end=' ')
		break
	elif a > b:
		print('NO')
		break
	if b % 2 == 0:
		b //= 2
		l.append(b)
	elif (b - 1) % 10 == 0:
		b = (b - 1) // 10
		l.append(b)
	else:
		print('NO')
		break


(a, b) = map(int, input().split())

def dfs(a, b, c=[]):
	s = False
	d = []
	if b < a:
		return (False, [])
	if a == b:
		return (True, c + [b])
	if b % 10 == 1:
		r = dfs(a, b // 10, c + [b])
		if r[0]:
			d = r[1]
			s = True
	if b % 2 == 0:
		r = dfs(a, b // 2, c + [b])
		if r[0]:
			d = r[1]
			s = True
	return (s, d)
(s, p) = dfs(a, b)
if s:
	p.reverse()
	print('YES')
	print(len(p))
	print(' '.join(list(map(str, p))))
else:
	print('NO')


(a, b) = map(int, input().strip().split())
x = 10
l = []
flag = 0
s = str(b)
if b < a:
	print('NO')
	flag = 1
elif b == a:
	print('YES')
	print(a, end=' ')
	flag = 1
else:
	while b >= a:
		if b % 2 != 0:
			if b % 10 == 1:
				l.append(b)
				b = b // 10
			else:
				l.append(b)
				break
		else:
			l.append(b)
			b = b // 2
	if l[-1] == a:
		l = l[::-1]
		print('YES')
		print(len(l))
		print(*l, sep=' ')
	else:
		print('NO')


def actionA(i):
	return i // 2

def actionB(i):
	return (i - 1) // 10

def getAction(i):
	if not i % 2:
		return actionA
	elif i % 10 == 1:
		return actionB
	else:
		return None

def fail():
	print('NO')

def m():
	(i, j) = (int(a) for a in input().split(' '))
	l = [j]
	while True:
		act = getAction(j)
		if act is None:
			return fail()
		j = act(j)
		l.append(j)
		if j < i:
			return fail()
		if j == i:
			break
	l.reverse()
	print('YES', len(l), ' '.join((str(i) for i in l)), sep='\n')
m()


(i, j) = map(int, input().split())
a = []
a.append(j)
c = 1
while j > i:
	if j % 2 == 0:
		j = j / 2
	else:
		j = (j - 1) / 10
	a.append(j)
	c += 1
if j == i:
	print('YES')
	print(c)
	for i in range(c):
		print(int(a[len(a) - i - 1]), end=' ')
else:
	print('NO')


import sys, math

def is_possible(num1, num2):
	if num1 > num2:
		return False
	elif num1 == num2:
		return True
	else:
		if is_possible(num1 * 2, num2):
			arr.append(num1 * 2)
			return True
		elif is_possible(num1 * 10 + 1, num2):
			arr.append(num1 * 10 + 1)
			return True
		return False
(a, b) = list(map(int, sys.stdin.readline().rstrip().split()))
arr = []
if is_possible(a, b):
	print('YES')
	print(len(arr) + 1)
	arr.reverse()
	print(f'{a} ' + ' '.join([str(i) for i in arr]))
else:
	print('NO')


(m, n) = (int(i) for i in input().split())
l = [n]
chls = []
while 1:
	if n < m:
		break
	if n % 2 == 0:
		n = n / 2
		chls.append(int(n))
	elif n % 10 == 1:
		n = (n - 1) / 10
		chls.append(int(n))
	else:
		break
	if n == m:
		break
if n == m:
	print('YES')
	print(len(chls) + 1)
	for i in range(len(chls) - 1, -1, -1):
		print(chls[i], end=' ')
	print(l[0], end='')
else:
	print('NO')


(a, b) = map(int, input().split())
sequencing = [b]

def recursive_function(number):
	if number == a:
		return True
	elif number < a:
		return False
	elif str(number).endswith('1'):
		sequencing.insert(0, int(str(number)[:-1]))
		return recursive_function(sequencing[0])
	elif number % 2 == 0:
		sequencing.insert(0, number // 2)
		return recursive_function(sequencing[0])
	else:
		return False
if recursive_function(b):
	print('YES')
	print(len(sequencing))
	print(*sequencing)
else:
	print('NO')


(a, b) = list(map(int, input().split()))
ans = list()
d = dict()

def transform(a, b):
	if a == b:
		ans.append(a)
		return True
	if a > b:
		return False
	if a in d:
		return d[a]
	val1 = a * 2
	val2 = a * 10 + 1
	flag = False
	if transform(val1, b) or transform(val2, b):
		ans.append(a)
		flag = True
	d[a] = flag
	return flag
flag = transform(a, b)
print('YES' if flag else 'NO')
if flag:
	print(len(ans))
	ans = map(str, ans[::-1])
	print(' '.join(ans))


def generateTracking(start, end, i, seq):
	if start == end:
		return seq
	else:
		double = start * 2
		digit = start * 10 + 1
		left = generateTracking(double, end, i + 1, [*seq, double]) if double <= end else []
		right = generateTracking(digit, end, i + 1, [*seq, digit]) if digit <= end else []
		return left or right
(a, b) = list(map(int, input().split()))
sequence = generateTracking(a, b, 1, [a])
if len(sequence) == 0:
	print('NO')
else:
	print('YES')
	print(len(sequence))
	print(*sequence, sep=' ')


from sys import setrecursionlimit
setrecursionlimit(10 ** 6)

def dfs(a, b):
	res.append(a)
	if a > b:
		res.pop()
		return
	elif a == b:
		print('YES')
		print(len(res))
		print(*res)
		exit()
	dfs(a * 2, b)
	dfs(a * 10 + 1, b)
	res.pop()
(a, b) = map(int, input().split())
res = [a]
dfs(a * 2, b)
dfs(a * 10 + 1, b)
print('NO')


(a, b) = map(int, input().split())
ar = []
ar.append(b)

def aps(a, b):
	if b < a:
		print('NO')
		return
	if a == b:
		print('YES')
		print(len(ar))
		s = ''
		ar.reverse()
		for i in ar:
			s += str(int(i)) + ' '
		print(s)
		return
	if b % 2 == 1:
		ar.append((b - 1) / 10)
		aps(a, (b - 1) / 10)
	else:
		ar.append(b / 2)
		aps(a, b / 2)
aps(a, b)


(a, b) = map(int, input().split())
num = []

def rec(n):
	num.append(n)
	if n == a:
		print('YES')
		print(len(num))
		print(*num[::-1])
		exit()
	if n > 9 and n % 10 == 1:
		rec(n // 10)
	if n % 2 == 0:
		rec(n // 2)
rec(b)
print('NO')


str = input().split()
A = int(str[0])
B = int(str[1])
c = B
mas = [B]
key = 0
while c > A:
	if c % 10 == 1:
		c = c // 10
	elif c % 2 == 0:
		c = c / 2
	else:
		key = 1
		break
	mas.append(c)
if c < A:
	key = 1
mas.reverse()
if key == 0:
	print('YES')
	print(len(mas))
	for i in range(len(mas)):
		print(int(mas[i]), end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
way = []
while b > a:
	way.append(b)
	if b % 2 == 0:
		b //= 2
	elif b % 10 == 1:
		b -= 1
		b //= 10
	else:
		print('NO')
		exit(0)
way.append(a)
if a != b:
	print('NO')
else:
	print('YES')
	print(len(way))
	print(*reversed(way))


(a, b) = map(int, input().split())
v = []
while True:
	v.append(b)
	if b <= a:
		break
	if b % 10 == 1:
		b = (b - 1) // 10
	elif b % 2 == 0:
		b //= 2
	else:
		break
if v[-1] == a:
	print('YES')
	print(len(v))
	print(*list(reversed(v)))
else:
	print('NO')


l = []
m = [0]

def findpath(a, b):
	if 2 * a > b and 10 * a + 1 > b:
		return 0
	if 2 * a == b:
		m[0] += 1
		l.append(b)
		return 1
	elif 10 * a + 1 == b:
		m[0] += 1
		l.append(b)
		return 1
	elif findpath(2 * a, b) == 1:
		m[0] += 1
		l.append(2 * a)
		return 1
	elif findpath(10 * a + 1, b) == 1:
		m[0] += 1
		l.append(10 * a + 1)
		return 1
	else:
		return 0
(a, b) = map(int, input().split())
findpath(a, b)
if m[0] == 0:
	print('NO')
else:
	print('YES')
	print(m[0] + 1)
	l.append(a)
	print(*l[::-1])


def recur(a, b, l):
	l.append(a)
	if a > b or a == b:
		return
	else:
		recur(a * 10 + 1, b, l)
		if l[-1] == b:
			return
		else:
			l.pop()
		recur(a * 2, b, l)
		if l[-1] == b:
			return
		else:
			l.pop()

def Transformation(a, b):
	lista = list()
	recur(a, b, lista)
	if lista[-1] != b:
		print('NO')
	else:
		print('YES')
		print(len(lista))
		print(lista[0], end='')
		for i in lista[1:]:
			print(' ' + str(i), end='')
(a, b) = input().split()
a = int(a)
b = int(b)
Transformation(a, b)


(a, b) = map(int, input().split())
ans = 1
ans2 = [b]
while b != a:
	if str(b)[-1] == '1':
		b = b // 10
		ans2.append(b)
		ans += 1
	elif b % 2 == 0:
		b = b // 2
		ans2.append(b)
		ans += 1
	else:
		print('NO')
		exit()
	if b < a:
		print('NO')
		exit()
ans2.reverse()
print('YES')
print(ans)
print(*ans2)


a = input()
A = []
A = a.split(' ')
a = int(A[0])
b = int(A[1])
c = b
bb = []
k = 0
while k == 0:
	if b % 10 == 3 or b % 10 == 5 or b % 10 == 7 or (b % 10 == 9):
		print('NO')
		k = 1
	elif b % 10 == 1:
		b = b // 10
		bb.append(b)
	else:
		b = b / 2
		bb.append(b)
	if b == a:
		print('YES')
		k = 1
		print(len(bb) + 1)
		for i in range(len(bb)):
			print(int(bb[len(bb) - 1 - i]), end=' ')
		print(c, end=' ')
	if b < a:
		print('NO')
		k = 1


(a, b) = [int(i) for i in input().split()]
res = [b]
n = b
while n > a:
	if n % 2 == 0:
		n = n // 2
		res.insert(0, n)
	elif n % 10 == 1:
		n = (n - 1) // 10
		res.insert(0, n)
	else:
		print('NO')
		break
else:
	if n == a:
		print('YES')
		print(len(res))
		print(' '.join([str(i) for i in res]))
	else:
		print('NO')


def generated_from(num):
	yield num
	while num != 0:
		if num % 10 == 1:
			num = num // 10
			yield num
		elif num % 2 == 0:
			num = num // 2
			yield num
		else:
			break
[a, b] = input().split()
(a, b) = (int(a), int(b))
can_generate_b = list(generated_from(b))
if a in can_generate_b:
	i = can_generate_b.index(a)
	steps = can_generate_b[:i + 1]
	steps.reverse()
	print('YES')
	print(len(steps))
	print(*steps)
else:
	print('NO')


from sys import stdin, stdout
(a, b) = map(int, stdin.readline().split())
q = [[a, [a]]]
ans = []
while len(q):
	f = q.pop(0)
	(cur, l) = (f[0], f[1])
	if cur == b:
		ans = l
		break
	(n1, n2) = (2 * cur, int(str(cur) + '1'))
	if n1 <= b:
		q.append([n1, l + [n1]])
	if n2 <= b:
		q.append([n2, l + [n2]])
if len(ans):
	stdout.write('YES\n')
	stdout.write('{}\n'.format(len(ans)))
	for x in ans:
		stdout.write('{} '.format(x))
	stdout.write('\n')
else:
	stdout.write('NO\n')


from collections import deque
(a, b) = input().split()
a = int(a)
b = int(b)
ant = {}
fila = deque([a])
while fila:
	v = fila.popleft()
	if 2 * v not in ant and 2 * v <= b:
		fila.append(2 * v)
		ant[2 * v] = v
	if 10 * v + 1 not in ant and 10 * v + 1 <= b:
		fila.append(10 * v + 1)
		ant[10 * v + 1] = v
seq = [b]
if b not in ant:
	print('NO')
else:
	print('YES')
	x = b
	while x != a:
		x = ant[x]
		seq.append(x)
	print(len(seq))
	for i in range(len(seq) - 1, -1, -1):
		print(seq[i], end=' ')
	print()


m = list(input().split(' '))
a = int(m[0])
b = int(m[1])
n = []
while b > a:
	n.append(b)
	if b % 2 == 0:
		b = int(b / 2)
	elif b % 10 == 1:
		b = int(b // 10)
	else:
		break
n.append(a)
if a == b:
	print('YES')
	print(len(n))
	for i in range(1, len(n) + 1):
		print(n[len(n) - i], '', end='')
else:
	print('NO')


(a, b) = map(int, input().split())
path = []

def recurs(n):
	global path
	global a
	if n == a:
		return True
	if n < a:
		return False
	if n % 2 == 0:
		x = recurs(n // 2)
		path.append(n)
		if x == True:
			return True
		path.pop()
	if (n - 1) % 10 == 0:
		x = recurs((n - 1) // 10)
		path.append(n)
		if x == True:
			return True
		path.pop()
	return False
x = recurs(b)
if x == True:
	print('YES')
	print(len(path) + 1)
	print(a, end=' ')
	for i in range(len(path)):
		print(path[i], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
ans = []
ww = int(b)
f = 0
while b > a:
	if b % 2 == 0:
		b = b // 2
		ans.append(b)
	elif str(b)[-1] == '1':
		t = str(b)
		b = int(t[:len(t) - 1])
		ans.append(b)
	else:
		f = 1
		break
if f == 1 or b < a:
	print('NO')
else:
	print('YES')
	print(len(ans) + 1)
	print(*ans[::-1], ww)


from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 8)
found = None

def rec(a, b, path):
	global found
	if found == True or found == False:
		return
	if a == b:
		path.append(a)
		print('YES')
		print(len(path))
		print(*path[::-1])
		return
	if b % 10 == 1 and b != 1:
		rec(a, b // 10, path + [b])
	elif b % 2 == 0:
		rec(a, b // 2, path + [b])
	else:
		print('NO')
		found = False
		return

def main():
	(a, b) = map(int, input().split())
	rec(a, b, [])
main()


def transforma(origem, destino):
	if origem[-1] == destino:
		return (origem, destino)
	elif origem[-1] > destino:
		return None
	else:
		numero = origem[-1]
		dest = numero * 2
		retorno = transforma(origem + [dest], destino)
		if retorno is None:
			numero = int(str(numero) + '1')
			return transforma(origem + [numero], destino)
		else:
			return retorno
entrada = input().split(' ')
origem = int(entrada[0])
destino = int(entrada[1])
transformacao = transforma([origem], destino)
if transformacao is None:
	print('NO')
else:
	(transformacao, destino) = transformacao
	print('YES')
	print(len(transformacao))
	print(' '.join([str(i) for i in transformacao]))


def search(x, y, path=''):
	if x > 10 ** 9:
		return
	if x == y:
		print('YES')
		print(len(path.split()) + 1)
		print(path + ' ' + str(y))
		raise AssertionError
	else:
		search(x * 2, y, path=path + (' ' if path else '') + str(x))
		search(x * 10 + 1, y, path=path + (' ' if path else '') + str(x))
(a, b) = map(int, input().split())
try:
	search(a, b)
except AssertionError:
	pass
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
c = b
d = ''
t = ''
n = [a]
while a != c:
	if c % 2 == 0 and a <= c:
		c = c / 2
		d = d + '1'
	elif (c - 1) % 10 == 0 and a <= c:
		c = (c - 1) / 10
		d = d + '2'
	else:
		break
if a == c:
	print('YES')
	t = d[::-1]
	f = len(t)
	print(len(t) + 1)
	for i in range(1, f + 1):
		if t[i - 1:i] == '1':
			a = a * 2
			n.append(a)
		else:
			a = a * 10 + 1
			n.append(a)
	for i in range(0, f + 1):
		print(n[i], end=' ')
elif c != a:
	print('NO')


(a, b) = map(int, input().split())
flag = True
ans = []
while b > a:
	if b % 2 == 0:
		ans.append(b)
		b //= 2
	elif b % 10 == 1:
		ans.append(b)
		b = (b - 1) // 10
	else:
		b = -1
ans.append(b)
if b != a:
	print('NO')
else:
	print('YES')
	print(len(ans))
	for i in range(len(ans) - 1, -1, -1):
		print(ans[i], end=' ')


def reach(a, b, path=[]):
	if a > b:
		return
	if a == b:
		path.append(a)
		print('YES')
		print(len(path))
		print(*path)
		exit(0)
	reach(a * 2, b, path + [a])
	reach(a * 10 + 1, b, path + [a])
(a, b) = map(int, input().split())
reach(a, b, [])
print('NO')


(a, b) = map(int, input().split())

def transformation(x, y, sequence):
	new_list = sequence[:]
	if x == y:
		new_list.append(x)
		return new_list
	elif x > y:
		return False
	else:
		new_list.append(x)
		return transformation(2 * x, y, new_list) or transformation(10 * x + 1, y, new_list)
result = transformation(a, b, [])
if result == False:
	print('NO')
else:
	print('YES')
	print(len(result))
	response = ''
	for i in result:
		response += str(i) + ' '
	print(response)


import sys
fin = sys.stdin
fout = sys.stdout
(a, b) = map(int, fin.readline().split())

def dfs(a, prev):
	if a > b:
		return
	if a == b:
		fout.write('YES\n')
		fout.write(str(len(prev) + 1) + '\n')
		prev.append(a)
		fout.write(' '.join(map(str, prev)))
		sys.exit()
	dfs(2 * a, prev + [a])
	dfs(10 * a + 1, prev + [a])
dfs(a, [])
fout.write('NO')


from __future__ import division, print_function
import os, sys
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 ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scan_int = lambda : int(input())
scan_string = lambda : input().rstrip()
read_list = lambda : list(read())
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

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

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

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

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

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

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

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

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	(a, b) = read()
	ans = []
	while b > a:
		ans.append(b)
		if b % 2 == 0:
			b //= 2
		elif b % 10 == 1:
			b //= 10
		else:
			break
	ans.append(b)
	if a == b:
		print('YES')
		print(len(ans))
		print(*ans[::-1])
	else:
		print('NO')
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')
for i in range(1):
	solve()


(a, b) = map(int, input().split())
flag = True
end = False
array = [b]
while flag and b != a:
	if b % 2 == 0 and b != 0:
		b //= 2
		array.append(b)
	elif b % 10 == 1:
		b //= 10
		array.append(b)
	else:
		flag = False
if flag:
	print('YES')
	print(len(array))
	for i in array[::-1]:
		print(i, end=' ')
else:
	print('NO')


def com1(x):
	return 2 * x

def com2(x):
	return 10 * x + 1

def decom2(x):
	return (x - 1) // 10

def decom1(x):
	return x // 2
(a, b) = map(int, input().split())
test = b
list1 = [b]
while test >= 1 and test != a:
	if test % 10 == 1:
		test = decom2(test)
	elif test % 2 == 0:
		test = decom1(test)
	else:
		break
	list1.append(test)
if test == a:
	print('YES')
	print(len(list1))
	for i in range(-1, -len(list1) - 1, -1):
		print(list1[i], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
L = [b]
bl = -50
while b > a:
	if b % 10 == 1:
		b //= 10
		L.append(b)
	elif b % 2 == 0:
		b //= 2
		L.append(b)
	if bl == b:
		break
	bl = b
	if b == a:
		print('YES')
		print(len(L))
		print(*reversed(L))
		exit()
print('NO')


(a, b) = map(int, input().split())
numbers = []

def transform(numbers, a, b):
	numbers.append(a)
	if a == b:
		print('YES')
		print(len(numbers))
		print(*numbers)
		exit()
	elif a > b:
		numbers.pop()
		return
	else:
		num1 = a * 2
		num2 = 10 * a + 1
		transform(numbers, num1, b)
		transform(numbers, num2, b)
	numbers.pop()
transform(numbers, a, b)
print('NO')


def trans(a, b):
	l = [b]
	while True:
		if l[-1] == a:
			l.reverse()
			return l
		if l[-1] < a:
			return []
		if l[-1] % 10 == 1:
			l.append(l[-1] // 10)
			continue
		if l[-1] % 2 == 0:
			l.append(l[-1] // 2)
			continue
		return []
(a, b) = list(map(int, input().split()))
r = trans(a, b)
if len(r) > 0:
	print('YES')
	print(len(r))
	print(*r)
else:
	print('NO')


line = list(map(int, input().split()))
a = line[0]
b = line[1]
k = 1
ns = [b]
while a != b:
	if a > b:
		print('NO')
		break
	if b % 2 == 0:
		b /= 2
		b = int(b)
	elif b % 10 == 1:
		b //= 10
	else:
		print('NO')
		break
	k += 1
	ns.insert(k, b)
else:
	print('YES')
	print(k)
	ns.reverse()
	print(' '.join(map(str, ns)))


(a, b) = input().split(' ')
a = int(a)
b = int(b)
seq = list()
seq.append(b)
while a != b and b and (b % 10 not in (3, 5, 7, 9)):
	if b % 10 == 1:
		b = b // 10
	else:
		b = b // 2
	seq.append(b)
if a == b:
	seq.reverse()
	print('YES')
	n = len(seq)
	print(n)
	for i in seq:
		print(i, end=' ', flush=True)
else:
	print('NO')


data = [int(x) for x in input().split()]
a = data[0]
b = data[1]

def anidar(arbol, nodo):
	arbol[nodo[0]] = [nodo[0] * 2, nodo[0] * 10 + 1]
	arbol[nodo[1]] = [nodo[1] * 2, nodo[1] * 10 + 1]
	if nodo[0] < b:
		anidar(arbol, arbol[nodo[0]])
	if nodo[1] < b:
		anidar(arbol, arbol[nodo[1]])
tree = {a: [2 * a, 10 * a + 1]}
anidar(tree, tree[a])
path = []
ans = ''
for key in tree:
	if b in tree[key]:
		path.append(b)
		path.append(key)
		ans = 'YES'
		break
else:
	ans = 'NO'
	print(ans)
if ans == 'YES':
	cond = True
	while a not in path:
		for key in tree:
			if path[len(path) - 1] in tree[key]:
				path.append(key)
				break
	path.reverse()
	print(ans)
	print(len(path))
	for i in range(0, len(path)):
		print(path[i], end='' if i == len(path) - 1 else ' ')


(a, b) = map(int, input().split())
(a1, b1) = (a, b)
sup = [b]
c = 0
while True:
	if b1 % 2 == 0 and b1 // 2 >= a:
		b1 = b1 // 2
		sup.append(b1)
	elif (b1 - 1) % 10 == 0 and (b1 - 1) // 10 >= a:
		b1 = (b1 - 1) // 10
		sup.append(b1)
	else:
		c = -1
		break
	if b1 == a1:
		break
	elif b1 == 0:
		break
if c == 0:
	print('YES')
	print(len(sup))
	for i in sup[::-1]:
		print(i, end=' ')
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
Temp = b
S = 1
while True:
	if Temp % 10 == 1:
		Temp //= 10
	else:
		Temp2 = Temp
		Temp //= 2
		if Temp * 2 != Temp2:
			print('NO')
			ExitC = 1
			break
	S += 1
	if Temp == a:
		print('YES', S, sep='\n')
		ExitC = 0
		break
	if Temp < a:
		print('NO')
		ExitC = 1
		break
if ExitC == 0:
	Temp = b
	M = [0 for i in range(S)]
	M[0] = a
	for i in range(S - 1, -1, -1):
		M[i] = Temp
		if Temp % 10 == 1:
			Temp //= 10
		else:
			Temp //= 2
		if Temp <= a:
			break
	for i in M:
		print(i, end=' ')


def transform(a, b, transformations=[]):
	current_transformations = transformations + [a]
	if a == b:
		return current_transformations
	if a > b:
		return False
	t1 = transform(2 * a, b, current_transformations)
	t2 = transform(10 * a + 1, b, current_transformations)
	if t1:
		return t1
	else:
		return t2
(a, b) = map(int, input().split())
t = transform(a, b)
if t:
	print('YES')
	print(len(t))
	print(*t)
else:
	print('NO')


s = input().split()
n1 = int(s[0])
n2 = int(s[1])
l = [n2]
while n2 > n1:
	a = n2 % 10
	if a == 1:
		n2 = n2 // 10
		l.insert(0, int(n2))
	elif a % 2 == 0:
		n2 = n2 // 2
		l.insert(0, int(n2))
	else:
		break
if l[0] == n1:
	print('YES')
	print(len(l))
	for i in l:
		print(i, end=' ')
else:
	print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

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

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

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

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
(a, b) = mi()
ans = [b]
while a < b:
	if b % 2 != 0 and b % 10 != 1:
		print('NO')
		exit()
	if b % 2 == 0:
		b //= 2
		ans.append(b)
	if b != 1 and b % 10 == 1:
		b //= 10
		ans.append(b)
if a == b:
	print('YES')
	print(len(ans))
	print(*ans[::-1])
else:
	print('NO')


def Solve(a, b):
	if a == b:
		return [a]
	if a > b:
		return []
	if b % 2 == 0:
		s = Solve(a, b // 2)
		if s:
			return s + [b]
	if b % 10 == 1:
		s = Solve(a, b // 10)
		if s:
			return s + [b]
	return []
(n, m) = (int(z) for z in input().split())
s = Solve(n, m)
if s:
	print('YES')
	print(len(s))
	print(' '.join(map(str, s)))
else:
	print('NO')


(a, b) = map(int, input().split())
A = [b]
flag = True
while b > 0:
	rem = b % 10
	if rem == 1:
		b -= 1
		b = b // 10
		A.append(b)
	elif rem % 2 == 0:
		b = b // 2
		A.append(b)
	else:
		flag = False
		break
	if b < a:
		flag = False
		break
	elif b == a:
		break
if not flag:
	print('NO')
else:
	print('YES')
	print(len(A))
	print(*A[::-1])


(n, target) = map(int, input().split())

def keep(target, ans):
	while target % 2 == 0:
		target = target // 2
		ans = [target] + ans
	if str(target).endswith('1') and target != 1:
		return keep((target - 1) // 10, [(target - 1) // 10] + ans)
	else:
		return (target, ans)
(next, nos) = keep(target, [target])
if n in nos:
	print('YES')
	nos = nos[nos.index(n):]
	print(len(nos))
	print(' '.join((str(k) for k in nos)))
else:
	print('NO')


(a, b) = [int(i) for i in input().split()]
s = str(b)
while b > a:
	if str(b)[-1] == '1':
		b = b // 10
		s += ' ' + str(b)
	elif b % 2 == 0:
		s += ' ' + str(b // 2)
		b = b // 2
	else:
		break
if b == a:
	print('YES')
	print(s.count(' ') + 1)
	print(' '.join(s.split()[::-1]))
else:
	print('NO')


(a, b) = map(int, input().split())
cur = b
res = []
while 1:
	if cur == a:
		print('YES')
		break
	if cur < a:
		print('NO')
		exit()
	elif cur % 2 == 0:
		cur //= 2
		res.append(cur)
	elif cur % 10 == 1:
		cur //= 10
		res.append(cur)
	else:
		print('NO')
		exit()
print(len(res) + 1)
print(*res[::-1], end=' ')
print(b)


a = input().split(' ')
m = int(a[0])
n = int(a[1])
lst = [n]
fl = 0
while n != m and n > m:
	if n % 2 == 0:
		k = int(n // 2)
		lst.append(k)
		n = k
	else:
		k = (n - 1) / 10
		if k != int(k):
			fl = 1
			break
		else:
			lst.append(int(k))
			n = k
if n == m:
	print('YES')
	print(len(lst))
	for i in lst[::-1]:
		print(i, end=' ')
elif fl == 1 or n != m:
	print('NO')


(a, b) = map(int, input().split())
v = b
c = []
k = 0
while a < b:
	z = len(str(b))
	if str(b)[z - 1] == '1':
		b = int((b - 1) / 10)
		c.append(b)
		k += 1
	elif b % 2 == 0:
		b = int(b / 2)
		c.append(b)
		k += 1
	else:
		break
if a != b:
	print('NO')
else:
	print('YES')
	print(k + 1)
	if len(c) == k:
		c = c[::-1]
		for x in c:
			print(x, end=' ')
		print(v)


(f, n) = map(int, input().split())
flag = True
lst = [n]
k = ''
while n > f:
	if n % 10 == 1:
		k = str(n)
		n = int(k[:len(k) - 1])
		if n < f:
			flag = False
			break
	elif n % 2 == 0:
		n //= 2
		if n < f:
			flag = False
			break
	elif n != f:
		flag = False
		break
	lst.append(n)
if flag:
	print('YES')
	print(len(lst))
	print(*reversed(lst))
else:
	print('NO')


(a, b) = map(int, input().split())
ansver = [b]
while True:
	if b % 2 == 0:
		b = b / 2
		ansver.append(b)
	else:
		b -= 1
		b = b / 10
		ansver.append(b)
	if b == a:
		print('YES')
		print(len(ansver))
		for i in range(len(ansver)):
			print(int(ansver[len(ansver) - i - 1]), end=' ')
		break
	if b < a:
		print('NO')
		break


(a_input, b_input) = map(int, input().split())

def transform_a_b(a, b):
	if a >= b:
		return [str(b)]
	if b % 2 == 0:
		return transform_a_b(a, b // 2) + [str(b)]
	elif b % 10 == 1:
		return transform_a_b(a, b // 10) + [str(b)]
	else:
		return [str(b)]
a_to_b = transform_a_b(a_input, b_input)
if str(a_input) != a_to_b[0]:
	print('NO')
else:
	print(f"YES\n{str(len(a_to_b))}\n{' '.join(a_to_b)}")


(a, b) = map(int, input().split())
B = str(b)
if b % 2 == 0 or B[-1] == '1':
	t = []
	u = 0
	while b != a:
		if b % 2 == 0:
			s = b // 2
			t.append(s)
			b = s
		elif str(b)[-1] == '1':
			if len(str(b)) == 1:
				b = 0
			else:
				h = int(str(b)[:-1])
				b = h
			t.append(b)
		else:
			print('NO')
			u += 1
			break
		if b < a:
			print('NO')
			u += 1
			break
	if u == 0:
		print('YES')
		print(len(t) + 1)
		print(*t[::-1] + [int(B)])
else:
	print('NO')


(a, b) = map(int, input().split())
tmp = b
answer = 'NO'
steps = []
while tmp > a:
	if tmp % 2 == 0:
		steps.append(int(tmp))
		tmp /= 2
	elif tmp % 10 == 1:
		steps.append(int(tmp))
		tmp //= 10
	else:
		answer = 'NO'
		break
if tmp == a:
	answer = 'YES'
	steps.append(a)
	steps.reverse()
	print(answer)
	print(len(steps))
	print(' '.join(map(str, steps)))
else:
	print(answer)


import sys
(a, b) = [int(x) for x in input().split()]
x = []
x.append(b)
while b > a:
	if b % 2 == 0:
		b = int(b / 2)
		x.append(b)
	elif b % 10 == 1:
		b = int((b - 1) / 10)
		x.append(b)
	else:
		print('NO')
		sys.exit()
if b < a:
	print('NO')
	sys.exit()
if b == a:
	print('YES')
	print(len(x))
	x.reverse()
	for i in range(len(x)):
		print(x[i], end=' ')


(a, b) = map(int, input().split())
cnt = 0
c = True
s = [b]
while b > a:
	if str(b)[-1] == '1':
		b //= 10
		s.append(b)
	elif b % 2 == 0:
		b //= 2
		s.append(b)
	else:
		c = False
		break
if c and a == b:
	print('YES')
	print(len(s))
	print(*s[::-1])
else:
	print('NO')


(a, b) = map(int, input().split())
seq = []

def d(s):
	if s > b:
		return False
	if s == b:
		return True
	for i in range(2):
		if i == 0:
			hit = d(2 * s)
			if hit:
				seq.append(2 * s)
				return True
		if i == 1:
			hit = d(10 * s + 1)
			if hit:
				seq.append(10 * s + 1)
				return True
d(a)
if len(seq) > 0:
	print('YES')
	seq.append(a)
	print(len(seq))
	for i in reversed(seq):
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
t = []
y = True
while b > a:
	if b % 10 == 1:
		t.append(b)
		b //= 10
	elif b % 2 == 0:
		t.append(b)
		b //= 2
	else:
		y = False
		break
t.append(b)
if b == a and y:
	print('YES')
	print(len(t))
	for i in range(len(t) - 1, -1, -1):
		print(t[i], end=' ')
else:
	print('NO')


import math
import sys
import itertools
import random

def lcm(x, y):
	return x * y // math.gcd(x, y)

def hcf(x, y):
	return math.gcd(x, y)

def backtrack(a, b, n, path):
	global g
	if n > b:
		return
	if n == b:
		g = path
	backtrack(a, b, n * 2, path + [n * 2])
	backtrack(a, b, int(str(n) + '1'), path + [int(str(n) + '1')])
(x, y) = map(int, input().strip().split())
g = []
backtrack(x, y, x, [x])
if g == []:
	print('NO')
else:
	print('YES')
	print(len(g))
	print(*g)


(a, b) = map(int, input().split())
R = [b]
while b > 0:
	while b % 2 == 0:
		b //= 2
		R.append(b)
		if b == a:
			print('YES')
			print(len(R))
			print(*R[::-1])
			exit()
	if b % 10 == 1:
		b //= 10
		R.append(b)
		if b == a:
			print('YES')
			print(len(R))
			print(*R[::-1])
			exit()
	else:
		print('NO')
		exit()
print('NO')


(a, b) = map(int, input().split())
ans = [b]
Ans = True
n = b
while n > a and Ans:
	if n % 2 == 0:
		n //= 2
		ans.append(n)
	elif n % 10 == 1:
		n //= 10
		ans.append(n)
	else:
		Ans = False
if Ans and ans[-1] == a:
	print('YES')
	print(len(ans))
	print(*ans[::-1])
else:
	print('NO')


(n, m) = map(int, input().split())
ls = [m]
if m % 10 == 1 or m % 2 == 0:
	while m >= n:
		fl = False
		while m % 2 == 0 and n != m:
			m //= 2
			ls.append(m)
			fl = True
		if m % 10 == 1 and n != m:
			m //= 10
			ls.append(m)
			fl = True
		if not fl:
			if n == m:
				print('YES')
				print(len(ls))
				print(*ls[::-1])
				break
			else:
				print('NO')
				break
	if m < n:
		print('NO')
else:
	print('NO')


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 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 Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
from collections import deque
(a, b) = Ri()
ans = []
flag = True
while b > a:
	if b % 2 == 1:
		if (b - 1) % 10 == 0:
			ans.append(b)
			b = (b - 1) // 10
		else:
			flag = False
			break
	else:
		ans.append(b)
		b = b // 2
if not flag:
	NO()
elif a == b:
	YES()
	print(len(ans) + 1)
	ans.append(a)
	print(*ans[::-1])
else:
	NO()


(a, b) = list(map(int, input().split()))
k = [b]
f = 1
while b > a:
	if b % 10 == 1:
		b -= 1
		b //= 10
	elif b % 2 == 0:
		b //= 2
	else:
		f = 0
		break
	k.append(b)
else:
	k.reverse()
	if k[0] == a:
		print('YES')
		print(len(k))
		print(*k)
	else:
		print('NO')
if f == 0:
	print('NO')


(a, b) = map(int, input().split())
l = [b]
while b % 2 == 0 or b % 10 == 1:
	if b == 0 or b == 1:
		break
	if b == a:
		break
	elif b % 2 == 0:
		b = int(b / 2)
		l.append(b)
	else:
		b = int((b - 1) / 10)
		l.append(b)
if b == a:
	print('YES')
	print(len(l))
	print(*reversed(l))
else:
	print('NO')


def dfs(t):
	if t > b:
		return
	if t == b:
		ans.append(t)
		return True
	if dfs(2 * t):
		ans.append(t)
		return True
	if dfs(10 * t + 1):
		ans.append(t)
		return True
	return False
ans = []
(a, b) = map(int, input().split())
if dfs(a):
	print('YES')
	print(len(ans))
	ans.reverse()
	print(*ans)
else:
	print('NO')


(a, b) = [int(i) for i in input().split()]
path = [b]
error = False
while b > a:
	if b % 2 == 0:
		b = b // 2
	elif str(b)[-1] == '1':
		b = (b - 1) // 10
	else:
		error = True
		break
	path.append(b)
if b == a and (not error):
	print('YES')
	print(len(path))
	print(' '.join([str(i) for i in path[::-1]]))
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
lista = []
lista.append(b)
while b > 0:
	if b % 2 == 0:
		b = b / 2
		lista.append(b)
	elif (b - 1) % 10 == 0:
		b = b - 1
		b = b / 10
		lista.append(b)
	else:
		break
	if a == b:
		break
if lista[-1] != a:
	print('NO')
else:
	print('YES')
	print(len(lista))
	list_size = len(lista)
	for i in range(list_size - 1, -1, -1):
		print(int(lista[i]), end=' ')
	print('')


from math import *
(a, b) = map(int, input().split())
ans = [b]
per = 0
while b > a:
	if str(b)[-1] == '1':
		b = int(str(b)[:-1])
		ans.append(b)
	elif b % 2 == 0:
		b = b // 2
		ans.append(b)
	else:
		per = 1
		break
if per == 0 and b == a:
	print('YES')
	print(len(ans))
	ans.reverse()
	print(' '.join(map(str, ans)))
else:
	print('NO')


def poisk(x, b):
	n.append(x)
	if x == b:
		return True
	if x > b:
		return False
	buff = poisk(10 * x + 1, b)
	if buff == n or buff:
		return n
	n.pop()
	buff = poisk(2 * x, b)
	if buff == n or buff:
		return n
	n.pop()
(a, b) = map(int, input().strip().split())
n = []
answ = poisk(a, b)
if answ == n:
	print('YES')
	print(len(answ))
	print(' '.join(list(map(str, answ))))
else:
	print('NO')


def pereob(ch1, ch2, ar):
	if ch1 == ch2:
		global con
		con = 1
		global pop
		pop = ar + []
	elif ch1 < ch2:
		ar1 = ar + [2 * ch1]
		pereob(2 * ch1, ch2, ar1)
		ar2 = ar + [ch1 * 10 + 1]
		pereob(ch1 * 10 + 1, ch2, ar2)
(a, b) = map(int, input().strip().split())
pop = [a]
con = 0
pereob(a, b, pop)
if con == 1:
	print('YES')
	print(len(pop))
	for i in pop:
		print(i, end=' ')
else:
	print('NO')


stroka = input().split()
a = int(stroka[0])
b = int(stroka[1])
ans = [b]
z = 0
while 1:
	if b == a:
		print('YES')
		print(len(ans))
		z = 1
		break
	elif b < a:
		print('NO')
		break
	elif b % 2 == 0 or str(b)[-1] == '1':
		if b % 2 == 0:
			b = b // 2
			ans = [b] + ans
		else:
			c = str(b)
			k = len(c)
			b = c[0:k - 1]
			b = int(b)
			ans = [b] + ans
	else:
		print('NO')
		break
if z == 1:
	for i in range(0, len(ans)):
		print(ans[i], end=' ')


A = list(map(int, input().split()))
a = A[0]
b = A[1]
A.clear()
A.append(b)
while b != a:
	if (b - 1) % 10 == 0 and b >= a:
		b = (b - 1) // 10
		A.append(b)
	elif b % 2 == 0 and b >= a:
		b = b // 2
		A.append(b)
	else:
		break
if a == b:
	A = sorted(A)
	print('YES')
	print(len(A))
	print(*A, sep=' ')
else:
	print('NO')


def fc(a, b, re, bl, tmp):
	if a > b:
		return
	if a == b:
		bl[0] = False
		re.append(tmp)
		return
	if bl[0]:
		fc(a * 2, b, re, bl, tmp + [a * 2])
		fc(a * 10 + 1, b, re, bl, tmp + [a * 10 + 1])
re = []
bl = [True]
(a, b) = map(int, input().split())
fc(a, b, re, bl, [])
if len(re) == 0:
	print('NO')
else:
	print('YES')
	print(1 + len(re[0]))
	ans = [[a] + re[0]]
	print(a, end=' ')
	for i in re[0]:
		print(i, end=' ')
	print()


flag = True

def fun(a, b, ind, temp):
	global flag
	if a == b:
		flag = False
		print('YES')
		print(ind)
		for i in range(0, ind - 1):
			print(temp[i], end=' ')
		print(temp[ind - 1])
		return
	if a > b:
		return
	temp[ind] = 2 * a
	fun(2 * a, b, ind + 1, temp)
	temp[ind] = 10 * a + 1
	fun(10 * a + 1, b, ind + 1, temp)
arr = list(map(int, input().split()))
temp = [0] * 32
temp[0] = arr[0]
fun(arr[0], arr[1], 1, temp)
if flag:
	print('NO')


(n, k) = list(map(int, input().split()))
answer = []
answer.append(k)
while k > n:
	if k % 2 == 0:
		k = k // 2
		answer.append(k)
	if k % 10 == 1 and k != 1:
		k = (k - 1) // 10
		answer.append(k)
	if k == n:
		print('YES')
		print(len(answer))
		l = len(answer)
		for i in range(l):
			print(answer[l - i - 1], ' ', end='')
		break
	elif k % 2 != 0 and k % 10 != 1 or k < n:
		print('NO')
		break


from collections import deque
entrada = input().split()
x = int(entrada[0])
b = int(entrada[1])
pai = {}
fila = deque()
fila.append(x)
pai[x] = -1
valorFinal = -1
while len(fila) > 0:
	valor = fila.popleft()
	if valor == b:
		valorFinal = valor
		break
	if valor < b:
		fila.append(2 * valor)
		pai[2 * valor] = valor
		fila.append(10 * valor + 1)
		pai[10 * valor + 1] = valor
if valorFinal == -1:
	print('NO')
else:
	sequencia = deque()
	valor = valorFinal
	while valor != -1:
		sequencia.appendleft(valor)
		valor = pai[valor]
	print('YES')
	print(len(sequencia))
	print(*sequencia)


def solve(n: int):
	global answer, a
	answer.append(n)
	if n <= a:
		return 0
	if n % 10 == 1:
		return solve(n // 10)
	elif n % 2 == 0:
		return solve(n // 2)
	else:
		print('NO')
		exit()
(a, b) = map(int, input().split())
answer = list()
solve(b)
if answer[-1] != a:
	print('NO')
else:
	print('YES')
	print(answer.__len__())
	for i in range(answer.__len__() - 1, -1, -1):
		print(answer[i], end=' ')


str = input()
mas1 = str.split()
a = int(mas1[0])
b = int(mas1[1])
k = 1
i = 0
mas = []
while a < b:
	mas.append(b)
	if b % 2 == 0:
		b = b // 2
		k = k + 1
	elif b % 10 == 1:
		b = (b - 1) // 10
		k = k + 1
	else:
		break
mas.reverse()
f = len(mas)
if a == b:
	print('YES')
	print(k)
	print(a, end=' ')
	while i < f:
		print(mas[i], end=' ')
		i += 1
else:
	print('NO')


import sys
an = list(map(int, input().split()))
s = str(an[1])
k = 1
n = an[1]
while n > an[0]:
	t = n / 2
	u = (n - 1) / 10
	if t % 1 == 0:
		s = str(int(t)) + ' ' + s
		k += 1
		n = t
	elif u % 1 == 0:
		s = str(int(u)) + ' ' + s
		k += 1
		n = u
	else:
		print('NO')
		sys.exit()
	if n == an[0]:
		print('YES')
		print(k)
		print(s)
		sys.exit()
print('NO')


(a, b) = map(int, input().split())

def main(a, b, ans, n):
	global out
	if a == b:
		out = [str(a) + ' ' + ans, n + 1]
		return
	b_s = str(b)
	if b > a and b_s[-1] == '1':
		main(a, int(b_s[:-1]), b_s + ' ' + ans, n + 1)
		return
	if b > a and b % 2 == 0:
		main(a, b // 2, b_s + ' ' + ans, n + 1)
		return
	else:
		out = ['youcannot', n]
		return
main(a, b, '', 0)
if out[0] == 'youcannot':
	print('NO')
else:
	print('YES')
	print(out[1])
	print(out[0])


s = input().split(' ')
a = int(s[0])
b = int(s[1])
s = ''
f = []
l = 0
f.append(b)
while b != a and b > 0:
	if b % 2 == 1:
		b = b - 1
		l = b % 10
		if l != 0:
			b = -1
		else:
			b = b // 10
	else:
		b = b // 2
	f.append(b)
for i in range(len(f), 0, -1):
	s = s + ' ' + str(f[i - 1])
s = s[1:]
if f[len(f) - 1] == a:
	print('YES')
	print(len(f))
	print(s)
if b == 0 or b < 0:
	print('NO')


(a, b) = map(int, input().split())
do = []
while True:
	do.append(b)
	if b == a:
		break
	if b % 2 == 0:
		b //= 2
	elif str(b)[-1] == '1':
		if b == 1:
			if a == 1:
				break
			else:
				print('NO')
				return
		else:
			b = int(str(b)[:-1])
	else:
		print('NO')
		return
do = do[::-1]
print('YES')
print(len(do))
print(*do)


(a, n) = map(int, input().split())
ans = []
fl = True
ans.append('*')
ans.append(n)
if str(n)[-1] == '3' or str(n)[-1] == '5' or str(n)[-1] == '7' or (str(n)[-1] == '9'):
	fl = False
else:
	while True:
		if n == a:
			break
		if n < a:
			fl = False
			break
		if str(n)[-1] == '1':
			q = str(n)
			q = q[:-1]
			n = q
			n = int(n)
			ans.append(n)
		elif n % 2 == 0:
			n = n // 2
			ans.append(n)
		else:
			fl = False
			break
if fl:
	print('YES')
	print(len(ans) - 1)
	print(*ans[-1:0:-1])
else:
	print('NO')


(a, b) = map(int, input().split())
numbers = []
is_B = True
numbers.append(b)
while b > a and is_B:
	if str(b)[len(str(b)) - 1] == '1':
		b = int((b - 1) / 10)
	elif b % 2 == 0:
		b = int(b / 2)
	else:
		is_B = False
	numbers.append(b)
if b < a:
	is_B = False
answer = ''
if is_B:
	print('YES')
	print(len(numbers))
	for n in range(len(numbers) - 1, -1, -1):
		answer += str(numbers[n])
		if n > 0:
			answer += ' '
	print(answer)
else:
	print('NO')


(a, b) = map(int, input().split())
mas = [b]
T = True
if b < a:
	print('NO')
else:
	while b != a:
		if b < a:
			print('NO')
			T = False
			break
		if b % 2 == 0:
			b = b / 2
			mas.append(b)
		elif b % 10 == 1:
			b = (b - 1) / 10
			mas.append(b)
		else:
			print('NO')
			T = False
			break
	if T:
		print('YES')
		print(len(mas))
		mas.reverse()
		for i in mas:
			print(int(i), end=' ')


(a, b) = map(int, input().split())
l = [b]
while a < b:
	if b % 2:
		if b % 10 == 1:
			b //= 10
			l.append(b)
		else:
			break
	else:
		b //= 2
		l.append(b)
if a == b:
	print('YES')
	print(len(l))
	print(*l[::-1])
else:
	print('NO')


read = lambda : list(map(int, input().split()))
(a, b) = read()
Q = [a]
prev = dict()
st = 0
while st < len(Q):
	cur = Q[st]
	st += 1
	if cur * 2 <= b:
		Q.append(cur * 2)
		prev[cur * 2] = cur
	if cur * 10 + 1 <= b:
		Q.append(cur * 10 + 1)
		prev[cur * 10 + 1] = cur
if prev.get(b) is None:
	print('NO')
	return
print('YES')
ans = []
cur = b
while cur != a:
	ans.append(cur)
	cur = prev[cur]
ans.append(a)
print(len(ans))
print(*ans[::-1])


(a, b) = map(int, input().split())
cnt = 1
ans = [b]
flag = True
while b > a:
	r = b % 10
	if r % 2 == 0:
		b //= 2
		cnt += 1
		ans.append(b)
	elif b % 10 % 2 != 0 and b % 10 != 1:
		flag = False
		break
	else:
		b //= 10
		ans.append(b)
		cnt += 1
if flag and a == b:
	print('YES')
	print(cnt)
	ans = list(reversed(ans))
	print(*ans)
else:
	print('NO')


(a, b) = map(int, input().split())
ost = []
e = bool
ost.append(b)
for i in range(b):
	if b % 2 == 0:
		if b == a:
			break
		ost.append(b // 2)
		b = b // 2
	else:
		if b == a:
			break
		if (b - 1) % 10 != 0:
			e = False
			break
		b = (b - 1) // 10
		ost.append(b)
ost.reverse()
if ost[0] != a or e == False:
	print('NO')
else:
	print('YES')
	print(len(ost))
	for i in ost:
		print(i, end=' ')


from sys import stdin, stdout

def readint():
	return map(int, stdin.readline().split())
(a, b) = readint()
t = b
x = []
x.append(b)
while True:
	if t == a:
		break
	elif t < a:
		print('NO')
		exit()
	if t % 2 == 0:
		t = t // 2
		x.append(t)
	elif t % 10 == 1:
		t = t // 10
		x.append(t)
	else:
		print('NO')
		exit()
print('YES')
print(len(x))
x.reverse()
print(*x)


(a, b) = map(int, input().split(' '))
iterations = [b]
while b > 0:
	if b % 2 == 0:
		b = b // 2
		iterations = [b] + iterations
	elif (b - 1) % 10 == 0:
		b = b // 10
		iterations = [b] + iterations
	else:
		break
	if b == a:
		break
if iterations[0] == a:
	print('YES')
	print(len(iterations))
	result = ''
	for i in range(len(iterations)):
		result += str(iterations[i]) + (' ' if i < len(iterations) - 1 else '')
	print(result)
else:
	print('NO')


(a, b) = map(int, input().split())
l = [b]
c = 1
if a == b:
	print('YES')
	print(0)
	print(a, b)
	exit()
while a != b:
	if a > b:
		print('NO')
		exit()
	elif b % 10 == 3 or b % 10 == 5 or b % 10 == 7 or (b % 10 == 9):
		print('NO')
		exit()
	elif b % 2 == 0:
		b = b // 2
		l.append(b)
		c = c + 1
	else:
		b = b // 10
		l.append(b)
		c = c + 1
print('YES')
print(len(l))
print(*l[::-1])
exit()


(aa, bb) = input().split()
a = int(aa)
b = int(bb)
v = []
v.append(b)
while b > a:
	if b % 2 == 0:
		b = b // 2
		v.append(b)
	else:
		r = b % 10
		if r != 1:
			break
		b = b // 10
		v.append(b)
	if b == a:
		break
v.sort()
if b == a:
	print('YES', end='\n')
	print(len(v))
	for i in v:
		print(i, end=' ')
else:
	print('NO')


(n, m) = map(int, input().split())
i = 0
s = ''
z = 0

def t(a, b, c, k, x, y):
	if a < c and b < c:
		x += str(a)
		x += ' '
		t(a * 2, b * 2, c, k + 1, x, y)
		t(a * 10 + 1, b * 10 + 1, c, k + 1, x, y)
	elif a == c or b == c:
		print('YES')
		print(k + 1)
		print(x + str(c))
		y += 1
		exit()
t(n, n, m, i, s, z)
if not z:
	print('NO')


from collections import deque
from collections import defaultdict

class TreeNode:

	def __init__(self, val=0):
		self.val = val
		self.left = None
		self.right = None

def find_shortest_path(graph, start, end, path=[]):
	path = path + [start]
	if start == end:
		return path
	if start not in graph:
		return None
	shortest = None
	for node in graph[start]:
		if node not in path:
			newpath = find_shortest_path(graph, node, end, path)
			if newpath:
				if not shortest or len(newpath) < len(shortest):
					shortest = newpath
	return shortest

def is_transform_possible(start, end):
	(cnt, path) = (0, [])
	if start == end:
		return (cnt, [])
	hmap = defaultdict(list)
	flag = False
	q = deque([a])
	while q:
		node = q.popleft()
		if node > 2 * end:
			break
		child1 = node * 2
		child2 = int(str(node) + '1')
		if child1 <= end:
			hmap[node].append(child1)
			q.append(child1)
		if child2 <= end:
			hmap[node].append(child2)
			q.append(child2)
		if child1 == end or child2 == end:
			flag = True
			break
	if flag:
		path = find_shortest_path(hmap, a, b)
		return (len(path), path)
	else:
		return (0, [])
(a, b) = map(int, input().split())
(tcnt, arr) = is_transform_possible(a, b)
if tcnt:
	print('YES')
	print(tcnt)
	print(*arr)
else:
	print('NO')


line1 = input()
data = line1.split(' ')
number = int(data[1])
delitel = int(data[0])
transformation = []
result = number
while result > delitel:
	if result % 2 == 0:
		transformation.append(result)
		result = int(result / 2)
	elif str(result)[len(str(result)) - 1] == '1':
		transformation.append(result)
		result = int((result - 1) / 10)
	else:
		flag = False
		break
if result == delitel:
	flag = True
	transformation.append(delitel)
else:
	flag = False
if not flag:
	print('NO')
else:
	print('YES')
	print(len(transformation))
	transformation.reverse()
	print(' '.join(map(str, transformation)))


(a, b) = map(int, input().split())
answer = []
flag = 0
while b > a:
	if b % 2 == 1:
		if b % 10 == 1:
			answer.append(b)
			b = (b - 1) // 10
		else:
			flag = 1
			break
	else:
		answer.append(b)
		b //= 2
	if b == a:
		answer.append(a)
		break
if a not in answer:
	flag = 1
if flag == 0:
	print('YES')
	print(len(answer))
	print(*answer[::-1])
else:
	print('NO')


(a, b) = map(int, input().split())
bb = b
A = [bb]
while bb != a and bb != 0:
	if bb % 10 == 1:
		bb //= 10
	elif bb % 2 == 0:
		bb //= 2
	else:
		break
	A.append(bb)
if bb != a:
	print('NO')
else:
	print('YES')
	print(len(A))
	for elem in A[::-1]:
		print(elem)


(a, b) = map(int, input().split())
moves = []
moves.append(b)
while b > a:
	if b % 2 == 0:
		b = int(b / 2)
		moves.append(b)
	elif str(b)[-1] == '1':
		b = int(str(b)[:-1])
		moves.append(b)
	else:
		break
if b != a:
	print('NO')
else:
	print('YES')
	print(len(moves))
	for i in range(len(moves) - 1, -1, -1):
		print(moves[i])


inp = [int(s) for s in input().split()]
check = 0
ans = [inp[1]]
while inp[0] != inp[1]:
	if inp[1] < inp[0]:
		print('NO')
		check = 1
		break
	if inp[1] % 2 == 0:
		inp[1] = inp[1] / 2
	elif inp[1] % 10 == 1:
		inp[1] = int(inp[1] / 10)
	else:
		print('NO')
		check = 1
		break
	ans.append(inp[1])
if check == 0:
	print('YES')
	print(len(ans))
	ans.reverse()
	for a in ans:
		print(int(a), end=' ')


def solve(l, x, a):
	if x < a:
		print('NO')
	elif x == a:
		l.append(x)
		print('YES')
		print(len(l))
		for i in range(len(l) - 1, 0, -1):
			print(l[i], end=' ')
		print(l[0])
	elif str(x)[-1] == '1':
		l.append(x)
		x = int(str(x)[0:-1])
		solve(l, x, a)
	elif x % 2 == 1:
		print('NO')
	else:
		l.append(x)
		solve(l, int(x / 2), a)

def main():
	(a, b) = [int(x) for x in input().split()]
	solve([], b, a)
main()


(number1, number2) = map(int, input().split())
ara = []
while number2 > number1:
	if number2 % 10 == 1:
		ara.append(number2)
		number2 = int(number2 / 10)
	elif number2 % 2 == 1:
		break
	else:
		ara.append(number2)
		number2 = int(number2 / 2)
ara.append(number2)
if number2 == number1:
	print('YES')
	print(len(ara))
	for i in ara[::-1]:
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
R = [b]
ok = 1
while b > a:
	while b % 10 != 1 and b > a:
		if b % 2 == 1:
			ok = 0
			break
		else:
			b = b // 2
			R += [b]
	if b > a:
		b = (b - 1) // 10
		R += [b]
if ok == 0 or b < a:
	print('NO')
else:
	print('YES')
	print(len(R))
	for i in range(len(R)):
		print(R[len(R) - 1 - i], end=' ')


lis = input().split()
(a, b) = (int(lis[0]), int(lis[1]))
parent = {}
parent[a] = None
stack = [a]
flag = False
while stack:
	node = stack.pop()
	if node == b:
		flag = True
		break
	elif node < b:
		n = [2 * node, 10 * node + 1]
		for i in n:
			parent[i] = node
			stack.append(i)
if not flag:
	print('NO')
else:
	print('YES')
	lis = []
	curr = b
	while curr != None:
		lis.append(curr)
		curr = parent[curr]
	lis.reverse()
	print(len(lis))
	for i in lis:
		print(i, end=' ')
	print()


import sys
sys.setrecursionlimit(10 ** 9)
(a, b) = map(int, input().split())
temp = a
f = False
res = []

def rec(n):
	global f
	global res
	if n == b:
		res.append(n)
		f = True
		return True
	elif n * 2 <= b:
		if rec(n * 2) == True:
			res.append(n)
			return True
		elif rec(n * 10 + 1) == True:
			res.append(n)
			return True
rec(a)
if f:
	print('YES')
	print(len(res))
	print(' '.join(map(str, res[::-1])))
else:
	print('NO')


def f(x, p):
	global b
	global ans
	if x < b:
		f(x * 10 + 1, p + [x * 10 + 1])
		f(x * 2, p + [x * 2])
	elif x == b:
		ans = p
(a, b) = map(int, input().split())
fl = True
if b % 2 == 1 and b % 10 != 1:
	fl = False
if fl:
	ans = []
	pp = [a]
	f(a, pp)
if not fl or len(ans) == 0:
	print('NO')
else:
	print('YES')
	print(len(ans))
	print(*ans)


def solve(n, prev):
	if n > b:
		return
	if n == b:
		print('YES')
		print(len(prev))
		print(*prev)
		exit()
	solve(n * 2, prev + [n * 2])
	solve(n * 10 + 1, prev + [n * 10 + 1])
(a, b) = list(map(int, input().split()))
solve(a, [a])
print('NO')


(a, b) = map(int, input().split())
possible = True
l = [str(b)]
while a < b:
	if b % 2 == 0:
		b >>= 1
	elif b % 10 == 1:
		b = int(b / 10)
	else:
		possible = False
		break
	l.append(str(b))
if a > b:
	possible = False
if possible:
	print('YES')
	print(len(l))
	print(' '.join(reversed(l)))
else:
	print('NO')


X = list(map(int, input().split()))
Answer = [X[0]]

def DFS(Num, Type):
	if Num > X[1]:
		return
	if Num == X[1]:
		print('YES')
		print(len(Answer))
		print(*Answer)
		exit()
	Num = Num * 2 if Type == 0 else Num * 10 + 1
	Answer.append(Num)
	DFS(Num, 0)
	Answer.pop()
	Answer.append(Num)
	DFS(Num, 1)
	Answer.pop()
DFS(X[0], 0)
DFS(X[0], 1)
print('NO')


def get_ops_list(a, b):
	if a == b:
		return [a]
	elif a > b:
		return []
	k = a * 2
	ops = get_ops_list(k, b)
	if len(ops) > 0:
		return [a, *ops]
	else:
		k = 10 * a + 1
		ops = get_ops_list(k, b)
		if len(ops) > 0:
			return [a, *ops]
		else:
			return []
(a, b) = list(map(int, input().split()))
ops = get_ops_list(a, b)
if len(ops) > 0:
	print('YES')
	print(len(ops))
	for n in ops:
		print(n, end=' ')
	print('')
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
k = str(b)
i = 0
while b // 10 >= a or b // 2 >= a:
	i += 1
	if b % 10 == 1:
		b = b // 10
	elif b % 2 == 0:
		b = b // 2
	else:
		break
	k = k + ' ' + str(b)
if b != a:
	print('NO')
else:
	print('YES')
	print(i + 1)
	print(*reversed(k.split()))


def delenie(n):
	if n % 2 == 0:
		return n // 2
	else:
		return -1

def delenie2(n):
	if (n - 1) % 10 == 0:
		return (n - 1) // 10
	else:
		return -1

def main(a1, b1, ans):
	if b1 == a1:
		print('YES')
		return ans
	elif b1 < a1:
		print('NO')
		exit()
	else:
		c = delenie(b1)
		c1 = delenie2(b1)
		if c != -1:
			ans.append(c)
			main(a1, c, ans)
		if c1 != -1:
			ans.append(c1)
			main(a1, c1, ans)
		if c == -1 and c1 == -1:
			print('NO')
			exit()
(a, b) = map(int, input().split())
ans = []
main(a, b, ans)
ans.reverse()
ans.append(b)
print(len(ans))
print(*ans)


lst = input().split()
a = int(lst[0])
b = int(lst[1])
result_lst = []
result_lst.append(b)
while b > a:
	if b % 10 == 1:
		b -= 1
		b //= 10
	elif b % 2 == 0:
		b //= 2
	else:
		break
	result_lst.append(b)
if b == a:
	print('YES')
	print(len(result_lst))
	result_lst.reverse()
	result_lst = [str(i) for i in result_lst]
	print(' '.join(result_lst))
else:
	print('NO')


(a, b) = tuple(map(int, input().split()))
r = []
c = True
r.append(b)
while b != a and b >= a:
	if b % 2 == 0:
		b = b // 2
		r.append(b)
	else:
		d = str(b)
		if d[-1] == '1':
			b = (b - 1) // 10
			r.append(b)
		else:
			break
			c = False
if c and b == a:
	print('YES')
	print(len(r))
	for x in range(0, len(r)):
		print(r[-1 - x], end=' ')
else:
	print('NO')


from collections import *
from math import *
(a, b) = list(map(int, input().split()))
ans = [b]
while b > a:
	if b % 10 == 1:
		b //= 10
	elif b % 10 & 1:
		print('NO')
		exit(0)
	else:
		b //= 2
	ans.append(b)
if a != b:
	print('NO')
else:
	print('YES')
	ans = ans[::-1]
	print(len(ans))
	print(*ans)


def dble(a):
	a = 2 * a
	return

def pl1(a):
	a = a * 10 + 1
	return
count = 1
(a, b) = map(int, input().split())
L = set()
err = 0
b1 = b
while a < b:
	if b % 10 == 1:
		b = (b - 1) // 10
		count += 1
		L.add(b)
	elif b % 2 == 0:
		b = b // 2
		count += 1
		L.add(b)
	else:
		err = 1
		break
	if a == b:
		break
if err == 0 and a == b:
	L.add(b1)
	print('YES')
	print(count)
	for i in sorted(L):
		print(i, sep='', end=' ')
else:
	print('NO')


def get_user_input():
	user_input = input().split()
	x = int(user_input[0])
	n = int(user_input[1])
	return (x, n)

def is_valid(x, n):
	return x <= n
results = []

def transformation(x, n, seq, i):
	if x == n:
		results.append((i, seq))
	else:
		value_append = 10 * x + 1
		value_double = 2 * x
		if is_valid(value_append, n):
			transformation(value_append, n, [*seq, str(value_append)], i + 1)
		if is_valid(value_double, n):
			transformation(value_double, n, [*seq, str(value_double)], i + 1)
(x, n) = get_user_input()
transformation(x, n, [str(x)], 1)
if len(results) > 0:
	print('YES')
	for result in results:
		print(result[0])
		print(' '.join(result[1]))
else:
	print('NO')


def transform(key, counter):
	if key > b:
		return False
	if key == b:
		output_dict[counter] = key
		return True
	aux = False
	aux = transform(key * 2, counter + 1)
	if aux:
		output_dict[counter] = key
		return True
	aux = transform(key * 10 + 1, counter + 1)
	if aux:
		output_dict[counter] = key
		return True
	return False
(a, b) = input().split()
a = int(a)
b = int(b)
output_dict = {}
if (a, b) >= (1, 1) and (a, b) <= (10 ** 9, 10 ** 9):
	if transform(a, 1):
		print('YES')
		output = ''
		print(len(output_dict))
		for key in range(1, len(output_dict) + 1):
			output += str(output_dict[key]) + ' '
		output = output.rstrip()
		print(output)
	else:
		print('NO')


def main():
	(a, b) = map(int, input().split())
	path = [b]
	while b > 0 and b != a:
		if b % 10 == 1:
			b //= 10
		elif b % 2 == 0:
			b //= 2
		else:
			path = None
			break
		path.append(b)
	if not path or path[-1] != a:
		print('NO')
	else:
		print('YES')
		print(len(path))
		print(' '.join([str(x) for x in reversed(path)]))
main()


IN = [int(i) for i in input().split()]
OUT = []
while IN[1] > IN[0]:
	if IN[1] % 10 == 1:
		OUT.append(IN[1])
		IN[1] = int((IN[1] - 1) / 10)
	elif IN[1] % 2 == 0:
		OUT.append(IN[1])
		IN[1] = int(IN[1] / 2)
	else:
		break
if IN[0] == IN[1]:
	OUT.append(IN[0])
	OUT.reverse()
	print('YES')
	print(len(OUT))
	for i in OUT:
		print(i, end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
count = 0
c = b
m = []
n = False
while True:
	if c < a:
		n = True
		break
	elif c % 10 == 1:
		m.append(int(c))
		c //= 10
		count += 1
		if c == a:
			m.append(int(c))
			break
	elif c % 2 == 0:
		m.append(int(c))
		c /= 2
		count += 1
		if c == a:
			m.append(int(c))
			break
	else:
		n = True
		break
if n:
	print('NO')
else:
	print('YES', len(m), ' '.join(list(map(str, list(reversed(m))))), sep='\n')


(a, b) = map(int, input().split())
l = [a]
q = [l]
flag = 0
m = []
while flag == 0 and q:
	x = q[-1]
	q.pop()
	t = x[-1]
	if t * 2 == b:
		flag = 1
		print('YES')
		print(len(x) + 1)
		print(*x, end=' ')
		print(t * 2)
		break
	elif 10 * t + 1 == b:
		flag = 1
		print('YES')
		print(len(x) + 1)
		print(*x, end=' ')
		print(10 * t + 1)
		break
	else:
		if 10 * t + 1 < b:
			g = x[:]
			g.append(10 * t + 1)
			m.append(g)
		if t * 2 < b:
			g = x[:]
			g.append(t * 2)
			m.append(g)
	if len(q) == 0:
		q = m[:]
		m = []
if flag == 0:
	print('NO')


(a, b) = map(int, input().split())
c = [str(b)]
while b > a:
	if b % 10 == 1 and b != 1:
		b //= 10
		c.append(str(b))
	elif b % 2 == 0:
		b //= 2
		c.append(str(b))
	if b == a:
		print('YES', len(c), ' '.join(c[::-1]), sep='\n')
		break
	elif b % 2 != 0 and b % 10 != 1 or b < a:
		print('NO')
		break


def main():

	def f(a, b):
		if a == b:
			return (True, [])
		if a > b:
			return (False, [])
		(f1, x1) = f(2 * a, b)
		if f1:
			return (True, [2 * a] + x1)
		(f2, x2) = f(int(str(a) + '1'), b)
		if f2:
			return (True, [int(str(a) + '1')] + x2)
		return (False, [])
	(a, b) = map(int, input().split(' '))
	(f, x) = f(a, b)
	if f:
		x = [a] + x
		print('YES')
		print(len(x))
		print(' '.join(list(map(str, x))))
	else:
		print('NO')
main()


inpt = str(input())
num = inpt.split(' ')[0]
wanted = inpt.split(' ')[1]

def next(inp, past):
	if str(inp) == str(wanted):
		return past
	if len(str(inp)) > len(str(wanted)):
		return ''
	return next(inp + '1', past + ' ' + inp) + next(str(int(inp) * 2), past + ' ' + inp)
try:
	out = str(next(num, ''))
	if out != '':
		print('YES\n' + str(len(out.split(' '))) + '\n' + str(out + ' ' + wanted).strip())
	else:
		print('NO')
except:
	print('NO')


def main():
	(a, b) = map(int, input().split())
	result = [b]
	while b > a:
		if b < a:
			print('NO')
			return
		if b % 2 == 0:
			b //= 2
			result.append(b)
		elif str(b)[-1] == '1':
			b = (b - 1) // 10
			result.append(b)
		else:
			print('NO')
			return
		if b == a:
			print('YES')
			print(len(result))
			result.reverse()
			print(' '.join(list(map(str, result))))
			return
	if b < a:
		print('NO')
		return
main()


def solve(a, b, l):
	if a > b:
		return False
	if a == b:
		return True
	x = solve(a * 2, b, l)
	y = solve(a * 10 + 1, b, l)
	if x or y:
		l.append(a)
	return x | y
(n, m) = list(map(int, input().split()))
l = []
if solve(n, m, l):
	print('YES')
	l.reverse()
	l.append(m)
	print(len(l))
	print(*l)
else:
	print('NO')


import sys

def a(c):
	nums = str(c).split(' ')
	a = int(nums[0])
	b = int(nums[1])
	c = int(nums[1])
	ns = []
	while int(a) != int(b):
		if len(str(int(b))) > 2:
			if int(b) % 2 == 0:
				b /= 2
				ns.append(int(b))
			elif str(int(b))[-1] == '1':
				m = str(int(b))
				b = int(m[0:-1])
				ns.append(int(b))
			else:
				break
		elif len(str(int(b))) == 2:
			if int(b) % 2 == 0:
				b /= 2
				ns.append(int(b))
			elif str(int(b))[-1] == '1':
				m = str(int(b))
				b = int(m[0:-1])
				ns.append(int(b))
			else:
				break
		elif int(b) % 2 == 0:
			b /= 2
			ns.append(int(b))
		else:
			break
	i = 1
	for el in ns:
		i += 1
	ns.sort()
	if a == int(b):
		print('YES')
		print(i)
		for el in ns:
			sys.stdout.write(str(el))
			sys.stdout.write(' ')
		print(c)
	else:
		print('NO')
a(str(input()))


var = input().split()
(a, b) = (int(var[0]), int(var[1]))
moves = []
status = False
while True:
	if b == a:
		status = True
		break
	elif b % 2 == 0:
		b = int(b / 2)
		moves.append('1')
	elif str(b)[-1:] == '1' and len(str(b)) >= 2:
		x = str(b)[:-1]
		b = int(x)
		moves.append('2')
	else:
		break
moves.reverse()
if status == True:
	print('YES')
	print(len(moves) + 1)
	print(a, end=' ')
	for i in range(len(moves)):
		if moves[i] == '1':
			a = a * 2
			print(a, end=' ')
		else:
			x = str(a) + '1'
			print(x, end=' ')
			a = int(x)
else:
	print('NO')


(a, b) = list(map(int, input().split(' ')))
ls = [b]
while b > a and (b % 2 == 0 or b % 10 == 1):
	if b % 2 == 0:
		b //= 2
	else:
		b //= 10
	ls.append(b)
if b != a:
	print('NO')
else:
	print('YES')
	print(len(ls))
	for x in ls[::-1]:
		print(x, end=' ')
	print()


import sys
import time
import math
from collections import defaultdict
from functools import lru_cache
INF = 10 ** 18 + 3
EPS = 1e-10
MAX_CACHE = 10 ** 9

def time_it(function, output=sys.stderr):

	def wrapped(*args, **kwargs):
		start = time.time()
		res = function(*args, **kwargs)
		elapsed_time = time.time() - start
		print('"%s" took %f ms' % (function.__name__, elapsed_time * 1000), file=output)
		return res
	return wrapped

@lru_cache(MAX_CACHE)
def turn(a, b):
	if a > b:
		return ()
	if a == b:
		return (b,)
	if turn(a * 2, b):
		return (a,) + turn(a * 2, b)
	if turn(a * 10 + 1, b):
		return (a,) + turn(a * 10 + 1, b)
	return ()

@time_it
def main():
	(a, b) = map(int, input().split())
	way = turn(a, b)
	if way:
		print('YES')
		print(len(way))
		print(*way)
	else:
		print('NO')

def set_input(file):
	global input
	input = lambda : file.readline().strip()

def set_output(file):
	global print
	local_print = print

	def print(*args, **kwargs):
		kwargs['file'] = kwargs.get('file', file)
		return local_print(*args, **kwargs)
set_input(open('input.txt', 'r') if 'MINE' in sys.argv else sys.stdin)
set_output(sys.stdout)
main()


(n, k) = map(int, input().split())
c = []
count = 0
while k >= n:
	if n == k:
		c.append(k)
		break
	if k % 2 == 0:
		c.append(k)
		k = k // 2
	else:
		c.append(k)
		if (k - 1) % 10 == 0:
			k = (k - 1) // 10
		else:
			break
if n == k:
	print('YES')
	print(len(c))
	c = c[::-1]
	print(*c, sep=' ')
else:
	print('NO')


def fun(x, y, d):
	d.append(y)
	if x == y:
		return True
	elif y % 10 == 1:
		return fun(x, y // 10, d)
	elif y % 2 == 0 and y != 0:
		return fun(x, y // 2, d)
	else:
		return False
(a, b) = map(int, input().split())
d = []
if fun(a, b, d):
	print('YES')
	print(len(d))
	print(*d[::-1])
else:
	print('NO')


import sys
(a, b) = map(int, input().split())
a1 = a
ans = []
ans.append(b)
while b != a:
	if b < a1:
		print('NO')
		sys.exit(0)
	elif b % 10 == 1:
		b //= 10
		ans.append(b)
	elif not b % 2:
		b //= 2
		ans.append(b)
	else:
		print('NO')
		sys.exit(0)
print('YES', len(ans), sep='\n')
print(*ans[::-1])


import sys
(a, b) = list(input().split())
c = 1
h = [int(b)]
while int(a) <= int(b):
	if a == b:
		print('YES')
		print(c)
		print(*h[-1::-1])
		sys.exit()
	if b[-1] == '1':
		b = b[:-1]
		h.append(int(b))
		c += 1
	elif int(b) % 2 == 0:
		h.append(int(b) // 2)
		b = str(int(b) // 2)
		c += 1
	else:
		print('NO')
		sys.exit()
print('NO')


global accepted
accepted = [False]

def transforma(lis, a, b, n):
	if accepted[0]:
		return 0
	newlis = lis[:]
	newlis.append(a)
	if a == b:
		print('YES')
		lista = str(newlis[0])
		for i in range(1, len(newlis)):
			lista += ' ' + str(newlis[i])
		print(n)
		print(lista)
		accepted[0] = True
		return 0
	elif a < b:
		transforma(newlis, 2 * a, b, n + 1)
		transforma(newlis, 10 * a + 1, b, n + 1)
	return 0

def main(args):
	entrada = list(map(int, input().split()))
	a = entrada[0]
	b = entrada[1]
	transforma([], a, b, 1)
	if not accepted[0]:
		print('NO')
	return 0
import sys
sys.exit(main(sys.argv))


v = []

def dfs(a, b):
	if a == b:
		print('YES', len(v), ' '.join(map(str, v)), sep='\n')
		exit()
	elif a > b:
		return
	else:
		for c in (2 * a, 10 * a + 1):
			v.append(c)
			dfs(c, b)
			v.pop()
(a, b) = map(int, input().split())
v.append(a)
dfs(a, b)
print('NO')


(a, b) = list(map(int, input().split()))
mass = [b]
f = 1
while b != a or f != 0:
	if b == a:
		f = 1
		break
	if b % 2 == 0:
		b /= 2
		b = int(b)
		mass.append(b)
	elif b % 10 == 1 and b != 1:
		b -= 1
		b /= 10
		b = int(b)
		mass.append(b)
	else:
		print('NO')
		f = 0
		break
if f == 1:
	print('YES')
	print(len(mass))
	for i in mass[::-1]:
		print(i, end=' ')


visited = {}
path = []

def dfs(source, target):
	visited[source] = True
	path.append(source)
	if source == target:
		return path
	if source > b // 2:
		return False
	i = source
	adj = (10 * i + 1 <= b) * [10 * i + 1] + (2 * i <= b) * [2 * i]
	for v in adj:
		if not visited.get(v, False):
			d = dfs(v, target)
			if d:
				return d
			path.pop()
(a, b) = map(int, input().split())
ans = dfs(a, b)
if ans:
	print('YES')
	print(len(ans))
	print(*ans)
else:
	print('NO')


s = input().split(' ')
a = int(s[0])
b = int(s[1])
arr = []

def foo(i):
	if i > b:
		return False
	if i == b:
		arr.append(i)
		return True
	ai = foo(i * 2)
	bi = foo(i * 10 + 1)
	if ai:
		arr.append(i)
		return True
	if bi:
		arr.append(i)
		return True
if foo(a):
	print('YES')
	print(len(arr))
	for i in range(0, len(arr)):
		print(arr[len(arr) - i - 1], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
s = [b]
k = 0
while b != a and b >= a:
	if b % 2 == 0:
		b = b // 2
		k += 1
		s += [b]
	elif b % 10 == 1:
		b = b // 10
		k += 1
		s += [b]
	else:
		break
if b == a:
	print('YES')
	print(k + 1)
	print(' '.join((str(s[i]) for i in range(k, -1, -1))))
else:
	print('NO')


(a, b) = map(int, input().split())
mass = [b]
while a != b:
	if str(b)[-1] != '1' and b % 2 != 0 and (a > b) or b == 0:
		print('NO')
		exit()
	else:
		if str(b)[-1] == '1' and len(str(b)) != 1:
			b = int(str(b)[:-1])
		elif b % 2 == 0:
			b = b // 2
		else:
			print('NO')
			exit()
		mass.append(b)
print('YES')
print(len(mass))
print(*mass[::-1])


def s(a, ans):
	if a > b:
		return
	if a == b:
		print('YES')
		print(len(ans))
		print(*ans)
		exit()
	else:
		s(2 * a, ans + [2 * a])
		s(10 * a + 1, ans + [10 * a + 1])
(a, b) = map(int, input().split())
s(a, [a])
print('NO')


(a, b) = list(map(int, input().split()))
vis = set()
achou = False

def tentar(curr):
	global b
	global achou
	if achou:
		return None
	ret = None
	qtd = len(vis)
	vis.add(curr)
	if len(vis) == qtd or curr > b:
		return None
	if curr == b:
		achou = True
		return [curr]
	branch1 = tentar(curr * 2)
	branch2 = tentar(curr * 10 + 1)
	if branch1 != None:
		branch1.append(curr)
		ret = branch1
	if branch2 != None:
		branch2.append(curr)
		ret = branch2
	return ret
resp = tentar(a)
if resp == None:
	print('NO')
else:
	print('YES')
	print(len(resp))
	print(' '.join(map(str, resp[::-1])))


from sys import exit
(a, b) = [int(i) for i in input().split()]
res = []
while 1:
	res.append(b)
	if b == a:
		break
	if b < a:
		print('NO')
		exit(0)
	if b % 2 == 0:
		b //= 2
	elif b % 10 == 1:
		b //= 10
	else:
		print('NO')
		exit(0)
print('YES\n', len(res), '\n', *reversed(res))


import sys
from collections import deque
sys.setrecursionlimit(10 ** 9)

def bfs(a, b):
	q = deque()
	prev = dict()
	q.append(a)
	while len(q) != 0:
		k = q.popleft()
		if k > b:
			continue
		if k == b:
			print('YES')
			ans = deque()
			while k != a:
				ans.appendleft(k)
				k = prev[k]
			ans.appendleft(a)
			print(len(ans))
			for el in ans:
				print(el, end=' ')
			exit()
		if k * 2 <= b:
			q.append(k * 2)
			prev[k * 2] = k
		if k * 10 + 1 <= b:
			q.append(k * 10 + 1)
			prev[k * 10 + 1] = k
(a, b) = map(int, input().split())
bfs(a, b)
print('NO')


(a, b) = map(int, input().split())
k = 1
r = []
r.append(b)
while b != a and b > a:
	if b % 10 == 1:
		b = b // 10
		k += 1
		r.append(int(b))
	elif b % 2 == 0:
		b = b / 2
		k += 1
		r.append(int(b))
	else:
		break
if b == a:
	print('YES')
	print(k)
	print(*r[::-1])
else:
	print('NO')


(a, b) = map(int, input().split())
l = [b]
flag = 'NO'
while a < b:
	if b % 2 == 0:
		b = b // 2
	else:
		t = str(b)
		if t[-1] == '1':
			t = t[:-1]
			b = int(t)
		else:
			break
	l.append(b)
	if a == b:
		flag = 'YES'
		break
print(flag)
if len(l) == 1 and l[-1] == a:
	print(2)
	print(a, a)
elif l[-1] == a:
	print(len(l))
	l.reverse()
	print(*l)


(present, final) = map(int, input().split(' '))
answer = list()
while final >= present:
	if final == present:
		answer.append(final)
		break
	if final % 2 == 0:
		answer.append(final)
		final = final // 2
	elif str(final)[len(str(final)) - 1] == '1':
		answer.append(final)
		final = (final - 1) // 10
	else:
		break
if final == present:
	print('YES')
	print(len(answer))
	for i in reversed(answer):
		print(i, end=' ')
else:
	print('NO')


import math
a = []

def dfs(pos, need):
	x = a[pos]
	if x > need:
		return
	if x == need:
		print('YES')
		print(pos + 1)
		print(*a)
		exit(0)
	a.append(x * 2)
	dfs(pos + 1, need)
	a.pop()
	a.append(10 * x + 1)
	dfs(pos + 1, need)
	a.pop()
(x, y) = map(int, input().split())
a = [x]
dfs(0, y)
print('NO')


(a, b) = map(int, input().split())

def nxt(seq):
	global b
	x = seq[-1]
	if not x > b:
		if x == b:
			return seq
		seq2 = seq.copy()
		seq2.append(int(str(seq[-1]) + '1'))
		ret = nxt(seq2)
		if ret:
			return ret
		seq2 = seq.copy()
		seq2.append(seq[-1] * 2)
		ret = nxt(seq2)
		if ret:
			return ret
	else:
		return False
ans = nxt([a])
if ans:
	print('YES')
	print(len(ans))
	print(*ans)
else:
	print('NO')


s = input()
s += ' '
k = 0
a = ''
b = ''
for i in s:
	if k == 0:
		if i != ' ':
			a += i
		else:
			k += 1
	elif k == 1:
		if i != ' ':
			b += i
a1 = []
b1 = []
a1 += a
b1 += b
a2 = int(a)
b2 = int(b)
y1 = b
y = []
while b2 > a2:
	if (b2 - 1) % 10 == 0:
		b2 = int((b2 - 1) / 10)
		if b2 < a2:
			print('NO')
			break
		y.append(b2)
	elif b2 % 2 == 0:
		b2 = int(b2 / 2)
		if b2 < a2:
			print('NO')
			break
		y.append(b2)
	else:
		print('NO')
		break
if b2 == a2:
	print('YES')
	print(len(y) + 1)
	y = y[::-1]
	for i in y:
		print(i, end=' ')
	print(y1)


from heapq import *
contest = True
if not contest:
	fin = open('in', 'r')
inp = input if contest else lambda : fin.readline()[:-1]
read = lambda : tuple(map(int, inp().split()))
(a, b) = read()

def req(a, b):
	if a > b:
		return (-1, [])
	if a == b:
		return (a, [b])
	if b % 2 == 0:
		v = req(a, b / 2)
		if v[0] == a:
			return (a, [b] + v[1])
	if b % 10 == 1:
		v = req(a, (b - 1) / 10)
		if v[0] == a:
			return (a, [b] + v[1])
	return (-1, [])
ans = req(a, b)
if ans[0] == -1:
	print('NO')
else:
	print('YES')
	print(len(ans[1]))
	print(' '.join([str(int(v)) for v in list(reversed(ans[1]))]))


(a, b) = map(int, input().split())
l = [b]
while True:
	if a == b:
		break
	if (b - 1) % 10 == 0:
		b -= 1
		b //= 10
	elif b % 2 == 0:
		b //= 2
	else:
		l = None
		break
	if b >= a:
		l.append(b)
	else:
		l = None
		break
if l is None:
	print('NO')
else:
	print('YES')
	print(len(l))
	l.reverse()
	print(*l)


ans = []

def dfs(a, b):
	if a == b:
		ans.append(a)
		return 1
	elif a > b:
		return 0
	ans.append(a)
	if dfs(2 * a, b) or dfs(10 * a + 1, b):
		return 1
	ans.pop()
	return 0
str = input().split()
a = int(str[0])
b = int(str[1])
flag = dfs(a, b)
if flag == 0:
	print('NO')
else:
	print('YES')
	print(len(ans))
	for i in range(len(ans)):
		print(ans[i], end=' ')


import sys
(a, b) = map(int, input().split())
anscnt = 1
ans = []
ans.append(b)
while b != a:
	if b < a:
		print('NO')
		exit(0)
	elif b % 10 == 1:
		b = (b - 1) // 10
	elif b % 2 == 0:
		b //= 2
	else:
		print('NO')
		exit(0)
	anscnt += 1
	ans.append(b)
print('YES')
print(anscnt)
print(*ans[::-1])


(n, x) = list(map(int, input().rstrip().split(' ')))
l = [x]
while x > n:
	if x == n:
		break
	if x % 10 == 1:
		x = x // 10
		l.append(x)
	elif x % 2 == 0:
		x = x // 2
		l.append(x)
	else:
		break
if l[-1] == n:
	print('YES')
	print(len(l))
	print(*l[::-1])
else:
	print('NO')


def func(a, b):
	if a == b:
		array.append(a)
		return 1
	if b % 2 == 0 and b // 2 >= a:
		c = func(a, b // 2)
		if c != 0:
			array.append(b)
			return c + 1
	if (b - 1) % 10 == 0 and b // 10 >= a:
		c = func(a, b // 10)
		if c != 0:
			array.append(b)
			return c + 1
	return 0
(a, b) = map(int, input().split())
array = []
c = func(a, b)
if c == 0:
	print('NO')
else:
	print('YES')
	print(c)
	print(*array)


(n, m) = map(int, input().split())
tek = m
oper = []
oper.append(tek)
while True:
	if tek % 10 == 1:
		tek = tek // 10
		oper.append(tek)
		if tek == n:
			break
	elif tek % 2 == 0:
		tek = tek // 2
		oper.append(tek)
		if tek == n:
			break
	else:
		oper = []
		break
	if tek < n:
		oper = []
		break
oper.reverse()
if oper != []:
	print('YES')
	print(len(oper))
	for i in oper:
		print(i, end=' ')
else:
	print('NO')


def pol(a, b):
	numbers = [b]
	while a < b:
		if b % 2 == 1:
			b = (b - 1) / 10
		else:
			b /= 2
		numbers.append(b)
	numbers.sort()
	if a == b:
		return (True, numbers)
	else:
		return (False, numbers)
(a, b) = [int(s) for s in input().split()]
(p, numbers) = pol(a, b)
if p:
	print('YES')
	print(len(numbers))
	[print(int(s), end=' ') for s in numbers]
else:
	print('NO')


(a, b) = input().split()
a = int(a)
b = int(b)
c = [b]
while b > a:
	if str(b)[len(str(b)) - 1] == '1':
		b = b // 10
	elif b % 2 == 1:
		break
	else:
		b = b // 2
	c.append(int(b))
if b == a:
	print('YES')
	print(len(c))
	for d in c[::-1]:
		print(d, '', end='')
else:
	print('NO')


(n, m) = map(int, input().split())
l = []
l.append(m)
while m > 0:
	if m % 10 == 1:
		m = m // 10
	elif m % 2 == 1:
		break
	else:
		m = m // 2
	l.append(m)
	if m == n:
		print('YES')
		print(len(l))
		print(*l[::-1])
		exit()
print('NO')


buf = []

def cal(b, a):
	buf.append(b)
	if a == b:
		return True
	elif b < a:
		return False
	elif b % 2 == 0:
		return cal(b // 2, a)
	elif b % 10 == 1:
		return cal((b - 1) // 10, a)
(a, b) = map(int, input().split())
if cal(b, a):
	print('YES')
	print(len(buf))
	print(' '.join((str(x) for x in buf[::-1])))
else:
	print('NO')


(a, b) = map(int, input().split())
ans = []
flag = True
while b > a and flag:
	if (b - 1) % 10 == 0:
		ans.append(str(b))
		b = (b - 1) // 10
	elif b % 2 == 0:
		ans.append(str(b))
		b //= 2
	else:
		flag = False
if b < a:
	flag = False
if flag:
	ans += [str(a)]
	print('YES')
	print(len(ans))
	print(' '.join(reversed(ans)))
else:
	print('NO')


(a, b) = list(map(int, input().split()))
passage = []
current = b
boo = True
while current > a:
	passage.append(current)
	if current % 10 == 1:
		current = (current - 1) // 10
	elif current % 2 == 0:
		current = current // 2
	else:
		boo = False
		break
if current == a:
	passage.append(a)
	print('YES')
	print(len(passage))
	for i in reversed(passage):
		print(i, end=' ')
	print('')
else:
	print('NO')


import sys
import math
import bisect

def solve(a, b):
	A = []
	while b > a:
		if b % 2 == 0:
			A.append(b)
			b //= 2
		elif b % 10 == 1:
			A.append(b)
			b //= 10
		else:
			break
	if b != a:
		return None
	A.append(b)
	A.reverse()
	return A

def main():
	(a, b) = map(int, input().split())
	A = solve(a, b)
	if A == None:
		print('NO')
	else:
		print('YES')
		print(len(A))
		print(' '.join(list((str(a) for a in A))))
main()


k = input()
n = k.split()
a = n[0]
b = n[1]
b1 = b
s = []
no = 0
while a != b:
	if b == '':
		break
	if int(b) % 10 == 1:
		b = b[0:-1]
		s.append(b)
		continue
	if int(b) % 2 == 0:
		b = str(int(int(b) / 2))
		s.append(b)
		continue
	if int(b) % 2 != 0:
		print('NO')
		no = 1
		break
s = list(reversed(s))
if a != b and no == 0:
	print('NO')
if a == b:
	print('YES')
	print(len(s) + 1)
	print(' '.join((str(x) for x in s)), b1)


(a, b) = map(int, input().split())
S = []
k = 0
Z = ''
while b > a:
	S.append(str('%.0f' % b))
	if b % 2 == 0:
		b = b // 2
	else:
		b = (b - 1) / 10
	k = k + 1
S.append(str('%.0f' % b))
for i in range(k + 1):
	Z = S[i] + ' ' + Z
if a == b:
	print('YES')
	print(k + 1)
	print(Z)
else:
	print('NO')


def transform(a, b):
	transformations = _transform(a, b, [b])
	if transformations[0] != a:
		print('NO')
	else:
		print('YES')
		print(len(transformations))
		print(' '.join(map(str, transformations)))

def _transform(a, b, transformations=[]):
	if b <= a:
		return transformations
	if b % 2 != 0:
		aux = (b - 1) / 10
		if aux.is_integer():
			transformations.insert(0, int(aux))
			return _transform(a, aux, transformations)
		else:
			return transformations
	else:
		aux2 = b / 2
		transformations.insert(0, int(aux2))
		return _transform(a, aux2, transformations)
(a, b) = [int(x) for x in input().split(' ')]
transform(a, b)


K = map
n = int
e = input
P = print
h = len
y = list
i = str
(a, b) = K(n, e().split())
x = [b]

def U():
	global a, b
	while b // 2 >= a:
		if b % 10 == 1:
			b = b // 10
		elif b % 2 == 0:
			b = b // 2
		else:
			P('NO')
			return
		x.append(b)
	x.reverse()
	if x[0] != a:
		P('NO')
		return
	P('YES')
	P(h(x))
	P(' '.join(y(K(i, x))))
U()


(a, b) = map(int, input().split())
bstart = b
shit = False
result = []
while not shit and b > a:
	if b % 10 != 1:
		if b % 2 == 1:
			shit = True
		else:
			b = b // 2
			result.append(b)
	elif b // 10 == 0:
		shit = True
	else:
		b = (b - 1) // 10
		result.append(b)
if not shit and b == a:
	print('YES')
	print(len(result) + 1)
	result.reverse()
	print(*result, bstart, sep=' ')
else:
	print('NO')


digl = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
mod = 10 ** 9 + 7
(a, b) = f()
l = [b]
flg = 0
while 1:
	if b == 1:
		if a == b:
			flg = 1
		break
	elif a == b:
		flg = 1
		break
	elif b % 2 == 0:
		b //= 2
		l.append(b)
	elif b % 10 == 1:
		b //= 10
		l.append(b)
	else:
		break
if flg == 1:
	print('YES')
	print(len(l))
	print(*l[::-1])
else:
	print('NO')


import sys, os.path
from collections import *
from copy import *
import math
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(a, b) = map(int, input().split())
c = 0
res = []
last = b
flag = 0
while last != a and last > a:
	res.append(last)
	if last % 2 == 0:
		last //= 2
	elif last % 10 == 1:
		t = last
		s = last
		s //= 10
		new = t - s
		last = last - new
	else:
		flag = 1
		break
if flag == 1:
	print('NO')
elif last < a:
	print('NO')
elif last == a:
	res.append(a)
	res.reverse()
	print('YES')
	print(len(res))
	print(*res)


def solve():
	(x, y) = list(map(int, input().split()))
	track = [[y]]
	ans = []
	tmp = y
	while track:
		last = track[-1][-1]
		trail = track[-1]
		if last == x:
			trail.reverse()
			ans = trail
			break
		elif last < x:
			track.pop()
		else:
			track.pop()
			if last % 10 == 1:
				track += [trail + [last // 10]]
			if last % 2 == 0:
				track += [trail + [last // 2]]
	if ans:
		print('YES')
		print(len(ans))
		for t in ans:
			print(t, end=' ')
	else:
		print('NO')
solve()


def translate(n, b):
	if n > b:
		return False
	if n == b:
		return (n,)
	x = translate(n * 2, b)
	if x:
		return (n, *x)
	y = translate(n * 10 + 1, b)
	if y:
		return (n, *y)
	return False
(a, b) = map(int, input().split())
ans = translate(a, b)
if ans:
	print('YES')
	print(len(ans))
	print(*ans)
else:
	print('NO')


(a, b) = list(map(int, input().split()))

def f(b):
	if b % 10 == 1:
		return int((b - 1) / 10)
	elif b % 2 == 0:
		return int(b // 2)
	else:
		return -1
c = [b]
if f(b) == -1:
	print('NO')
else:
	for i in range(1, b):
		if a == f(b):
			c.append(a)
			print('YES')
			print(len(c))
			for i in range(len(c) - 1, -1, -1):
				print(c[i], end=' ')
			break
		if b < a:
			print('NO')
			break
		else:
			b = f(b)
			c.append(b)


(q, w) = map(int, input().split())
a = []
while w > q:
	if w % 10 == 1:
		a.append(w)
		w //= 10
	elif w % 2 == 1:
		w = q - 1
	else:
		a.append(w)
		w //= 2
a.append(w)
if w == q:
	print('YES')
	print(len(a))
	for i in a[::-1]:
		print(i, end=' ')
else:
	print('NO')


st = str(input())
d = st.split(' ')
a = int(d[0])
b = int(d[1])
A = []
A.append(b)
c = b
while not c == a and c > a:
	if c % 2 == 0:
		c = c // 2
		A.append(c)
	elif c % 10 == 1:
		c = (c - 1) // 10
		A.append(c)
	else:
		print('NO')
		break
if c == a:
	print('YES')
	print(int(len(A)))
	s = ''
	l = len(A)
	for i in range(len(A)):
		s = s + str(A[len(A) - i - 1]) + ' '
	print(s)
if not c == a and c < a:
	print('NO')


(a, b) = map(int, input().split())
ans = [b]
lans = 1
while b > a:
	if b % 10 == 1:
		b = b // 10
	elif not b % 2:
		b = b // 2
	else:
		print('NO')
		exit()
	ans.append(b)
	lans += 1
if ans[-1] != a:
	print('NO')
else:
	print('YES')
	print(lans)
	ans.reverse()
	print(*ans)


(a, b) = map(int, input().split())
w = b
f = 1
ans = []
while b > a:
	x = str(b)
	if x[len(x) - 1] == '1':
		b = int(x[:-1])
	else:
		if b % 2 != 0:
			print('NO')
			f = 0
			break
		b = b // 2
	if b >= a:
		ans.insert(0, b)
	else:
		print('NO')
		f = 0
		break
if f:
	ans.append(w)
	print('YES')
	print(len(ans))
	for i in ans:
		print(i, end=' ')


from sys import stdin as fin
(a, b) = map(int, fin.readline().split())
chain = []
while a < b:
	chain.append(str(b))
	if b % 10 == 1:
		b //= 10
	elif b % 2 == 0:
		b //= 2
	else:
		break
if a == b:
	print('YES')
	print(len(chain) + 1)
	print(a, ' '.join(reversed(chain)))
else:
	print('NO')


(a, b) = [int(x) for x in input().split()]
(a, b) = (str(a), str(b))
l = [b]
count = 1
flag = 0
while int(b) > int(a):
	b = str(b)
	if b[-1] == '1':
		b = b[0:-1]
		l.append(b)
		count += 1
	elif int(b) % 2 == 0:
		b = str(int(int(b) / 2))
		l.append(b)
		count += 1
	else:
		flag = 1
		break
if flag == 1 or b < a:
	print('NO')
else:
	print('YES')
	print(count)
	for i in l[::-1]:
		print(i, end=' ')


(n, k) = map(int, input().split())
l1 = []
l1.append(k)
while True:
	if k % 2 != 0 and k % 10 != 1:
		break
	elif k % 2 == 0:
		k = int(k / 2)
		l1.append(k)
	elif k % 10 == 1:
		k = int(k / 10)
		l1.append(k)
	if k == n or k < n:
		break
if k == n:
	print('YES')
	print(len(l1))
	l1.sort()
	for i in range(len(l1)):
		print(l1[i], end=' ')
else:
	print('NO')


(a, b) = map(int, input().split())
d = 1
if a > b:
	print('NO')
else:
	was = []
	was += [b]
	while b > a:
		if b % 2 == 0:
			was = was + [b // 2]
			b = b // 2
		elif b % 10 == 1:
			was += [b // 10]
			b = b // 10
		else:
			d = 0
			b = b // 10
	if b == a:
		if d == 1:
			print('YES')
			print(len(was))
			was1 = was[::-1]
			print(*was1)
		else:
			print('NO')
	else:
		print('NO')


(x, y) = map(int, input().split())
a = [y]
while y > x:
	if y % 2 == 0:
		y //= 2
		a.append(y)
	elif y % 10 == 1:
		y //= 10
		a.append(y)
	else:
		break
if x == y:
	print('YES')
	print(len(a))
	print(' '.join(map(str, a[::-1])))
else:
	print('NO')


(a, b) = map(int, input().split())
lastDigit = b % 10
if lastDigit in [3, 5, 7, 9]:
	print('NO')
else:
	ans = 0
	transform = [b]
	while a < b:
		lastDigit = b % 10
		if lastDigit in [3, 5, 7, 9]:
			print('NO')
			exit()
		ans += 1
		if lastDigit == 1:
			b = b // 10
			transform.append(b)
		else:
			b //= 2
			transform.append(b)
	if b == a:
		print('YES')
		print(len(transform))
		transform.reverse()
		for i in transform:
			print(i, end=' ')
		print()
	else:
		print('NO')


numbers = input().split()
A = int(numbers[0])
B = int(numbers[1])
temp = [int(d) for d in str(B)]
finished = False
rta = 'NO'
count = 1
listRta = []
listRta.append(B)
while finished == False:
	if A == B:
		finished = True
		rta = 'YES'
		break
	elif B < A:
		finished = True
		break
	elif A < B and B < 2 * A:
		finished = True
		break
	temp = [int(d) for d in str(B)]
	if temp[len(temp) - 1] == 1:
		B = int((B - 1) / 10)
		listRta.append(B)
		count += 1
	elif temp[len(temp) - 1] % 2 != 0:
		break
	else:
		B = int(B / 2)
		listRta.append(B)
		count += 1
if rta == 'NO':
	print(rta)
else:
	print(rta)
	print(count)
	listRta.reverse()
	rtaString = ''
	for i in listRta:
		rtaString += str(i) + ' '
	rtaString = rtaString[:-1]
	print(rtaString)


(a, b) = map(int, input().split(' '))
resposta = []
aux = b
resposta.append(aux)
while aux > a:
	if aux % 2 == 0:
		aux = int(aux / 2)
		resposta.append(aux)
	elif (aux - 1) % 10 == 0:
		aux = int((aux - 1) / 10)
		resposta.append(aux)
	else:
		break
if aux == a:
	print('YES')
	print(len(resposta))
	str_Resposta = ''
	for i in range(len(resposta) - 1, -1, -1):
		if i == 0:
			str_Resposta += str(resposta[i])
		else:
			str_Resposta += str(resposta[i]) + ' '
	print(str_Resposta)
else:
	print('NO')


from collections import deque
(a, b) = map(int, input().split())
aux = {}
fila = deque([a])
while fila:
	v = fila.popleft()
	if 2 * v not in aux and 2 * v <= b:
		fila.append(2 * v)
		aux[2 * v] = v
	if 10 * v + 1 not in aux and 10 * v + 1 <= b:
		fila.append(10 * v + 1)
		aux[10 * v + 1] = v
coletados = [b]
if b not in aux:
	print('NO')
else:
	print('YES')
	x = b
	while x != a:
		x = aux[x]
		coletados.append(x)
	print(len(coletados))
	for e in coletados[::-1]:
		print(e, end=' ')


(a, b) = map(int, input().split())
k = [b]
if len(str(b)) <= 9:
	while b > a:
		if b % 2 == 0:
			b = int(b / 2)
			k.append(b)
		else:
			b = int(b // 10)
			k.append(b)
	k.reverse()
	if min(k) == a:
		print('YES')
		print(len(k))
		for item in k:
			print(item, end=' ')
	else:
		print('NO')
else:
	print('NO')


a = input()
s = []
T = 'NO'
b = 0
b = a[a.find(' ') + 1:]
a = a[0:a.find(' ')]
a = int(a)
b = int(b)
s.append(b)
new_s = ''
try:
	if b <= 1000000000 and b > a and (a >= 1):
		for i in range(a, b):
			if b % 2 != 0:
				b = (b - 1) / 10
				s.append(b)
			elif b % 2 == 0:
				b = b / 2
				s.append(b)
			if b < a:
				T = 'NO'
				break
			if b == a:
				T = 'YES'
				break
		if T == 'YES':
			s.reverse()
			print(T)
			print(len(s))
			for element in s:
				new_s = new_s + str(int(element)) + ' '
			print(new_s[:len(new_s) - 1])
		else:
			print(T)
	new_s = ''
	s = []
	T = ''
	b = 0
except (TypeError, ValueError):
	print()


(a, n) = map(int, input().split())
ans = []
r = n
j = 0
z = 0
for g in range(int(n ** 0.5)):
	s = str(n)
	if s[-1] == '1':
		s = s[0:len(s) - 1]
		if s != '':
			n = int(s)
		ans.append(n)
		j += 1
		if n == a:
			z = 1
			break
	if n % 2 == 0:
		n = n // 2
		ans.append(n)
		j += 1
		if n == a:
			z = 1
			break
t = 1
if z == 0:
	print('NO')
else:
	print('YES')
	print(j + 1)
	for i in range(len(ans) - 1, -1, -1):
		print(ans[i], end=' ')
	print(r)


nums = input().split()
a = int(nums[1])
path = [a]
while True:
	if a == int(nums[0]):
		print('YES')
		print(len(path))
		path.reverse()
		print(' '.join(list(map(str, path))))
		break
	elif a // 2 == a / 2:
		a = a / 2
		path.append(int(a))
	else:
		a = (a - 1) / 10
		path.append(int(a))
	if a != int(a) or a < int(nums[0]):
		print('NO')
		break


def recursion(a, b):
	if b == a:
		return [a]
	if b == 0:
		return []
	if b % 2 == 0:
		s = recursion(a, b // 2)
		if len(s) > 0:
			return s + [b]
		else:
			return []
	elif b % 10 == 1:
		s = recursion(a, (b - 1) // 10)
		if len(s) > 0:
			return s + [b]
		else:
			return []
	else:
		return []
(a, b) = list(map(int, input().split()))
answer = recursion(a, b)
if len(answer) == 0:
	print('NO')
else:
	print('YES')
	print(len(answer))
	print(' '.join(map(str, answer)))


(a, b) = list(map(int, input().split()))
A = [b]
Bool = False
while True:
	if a >= b:
		if a == b:
			Bool = True
		else:
			Bool = False
		break
	elif str(b)[-1] == '1':
		b = int(str(b)[:len(str(b)) - 1])
		A.append(b)
	elif b % 2 == 0:
		b = b // 2
		A.append(b)
	else:
		break
if Bool == False:
	print('NO')
else:
	print('YES')
	print(len(A))
	print(*A[::-1])


(a, b) = input().split()
a = int(a)
b = int(b)
f = 0
l = []
while b > a:
	if b % 2 == 1:
		if (b - 1) % 10 == 0:
			l.append(b)
			b = (b - 1) // 10
		else:
			print('NO')
			f = 1
			break
	else:
		l.append(b)
		b = b // 2
if f == 0:
	if a == b:
		print('YES')
		l.append(a)
		print(len(l))
		for i in range(len(l)):
			print(l[len(l) - i - 1], end=' ')
	else:
		print('NO')