The Squareland national forest is divided into equal 1 × 1 square plots aligned with north-south and east-west directions. Each plot can be uniquely described by integer Cartesian coordinates (x, y) of its south-west corner.

Three friends, Alice, Bob, and Charlie are going to buy three distinct plots of land A, B, C in the forest. Initially, all plots in the forest (including the plots A, B, C) are covered by trees. The friends want to visit each other, so they want to clean some of the plots from trees. After cleaning, one should be able to reach any of the plots A, B, C from any other one of those by moving through adjacent cleared plots. Two plots are adjacent if they share a side.

<image> For example, A=(0,0), B=(1,1), C=(2,2). The minimal number of plots to be cleared is 5. One of the ways to do it is shown with the gray color.

Of course, the friends don't want to strain too much. Help them find out the smallest number of plots they need to clean from trees.

Input

The first line contains two integers x_A and y_A — coordinates of the plot A (0 ≤ x_A, y_A ≤ 1000). The following two lines describe coordinates (x_B, y_B) and (x_C, y_C) of plots B and C respectively in the same format (0 ≤ x_B, y_B, x_C, y_C ≤ 1000). It is guaranteed that all three plots are distinct.

Output

On the first line print a single integer k — the smallest number of plots needed to be cleaned from trees. The following k lines should contain coordinates of all plots needed to be cleaned. All k plots should be distinct. You can output the plots in any order.

If there are multiple solutions, print any of them.

Examples

Input


0 0
1 1
2 2


Output


5
0 0
1 0
1 1
1 2
2 2


Input


0 0
2 0
1 1


Output


4
0 0
1 0
1 1
2 0

Note

The first example is shown on the picture in the legend.

The second example is illustrated with the following image:

<image>

Difficulty: MEDIUM_HARD
Tags: Mathematics

Implementation
Expected Time Complexity: O(NLOG(N))

Starter code:

Solutions:
s = [[int(i) for i in input().split()] for j in range(3)]
s.sort()
a = s[0]
b = s[1]
c = s[2]
print(c[0] - a[0] + max(a[1], b[1], c[1]) - min(a[1], b[1], c[1]) + 1)
for i in range(a[0], b[0]):
	print('{} {}'.format(i, a[1]))
for i in range(min(a[1], b[1], c[1]), max(a[1], b[1], c[1]) + 1):
	print('{} {}'.format(b[0], i))
for i in range(b[0] + 1, c[0] + 1):
	print('{} {}'.format(i, c[1]))


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
p0 = getIntList()
p1 = getIntList()
p2 = getIntList()
zp = [p0, p1, p2]

def getpath(p0, p1):
	if p0[0] < p1[0]:
		sp = 1
	elif p0[0] > p1[0]:
		sp = -1
	else:
		sp = 0
	zz = [tuple(p0), tuple(p1)]
	if sp != 0:
		for x in range(p0[0], p1[0] + sp, sp):
			tp = (x, p0[1])
			zz.append(tp)
	if p0[1] < p1[1]:
		sp = 1
	elif p0[1] > p1[1]:
		sp = -1
	else:
		sp = 0
	if sp != 0:
		for y in range(p0[1], p1[1] + sp, sp):
			tp = (p1[0], y)
			zz.append(tp)
	return zz
nr = 1000000
zr = set()
for i in range(3):
	for j in range(3):
		cx = zp[i][0]
		cy = zp[j][1]
		cp = (cx, cy)
		z1 = getpath(cp, zp[0])
		z2 = getpath(cp, zp[1])
		z3 = getpath(cp, zp[2])
		z0 = z1 + z2 + z3
		s1 = set(z0)
		dprint(cp, s1)
		if len(s1) < nr:
			nr = len(s1)
			zr = s1
print(len(zr))
for x in zr:
	print(x[0], x[1])


import math
arr = []
for _ in range(3):
	arr.append(list(map(int, input().split())))
out = arr[:]

def f(el):
	return el[0]
arr.sort(key=f)
nX = arr[0][0]
nY = arr[0][1]
while nX < arr[1][0]:
	nX += 1
	out.append([nX, nY])
while nY != arr[1][1]:
	if nY > arr[1][1]:
		nY -= 1
	else:
		nY += 1
	out.append([nX, nY])
nX = arr[1][0]
nY = arr[1][1]
while nY != arr[2][1]:
	if nY > arr[2][1]:
		nY -= 1
	else:
		nY += 1
	out.append([nX, nY])
while nX != arr[2][0]:
	nX += 1
	out.append([nX, nY])
d = list(set((tuple(i) for i in out)))
print(len(d))
for i in range(len(d)):
	d[i] = list(d[i])
	print(*d[i])


(xa, ya) = map(int, input().split())
(xb, yb) = map(int, input().split())
(xc, yc) = map(int, input().split())
ans = []
xl = xb - xa
xs = yb - ya
a = abs(xl)
b = abs(xs)
(x, y) = (xa, ya)
dis = [[xa, ya], abs(xa - xc) + abs(ya - yc)]
for i in range(abs(xl) + abs(xs)):
	if a > 0 and b > 0:
		(x1, y1) = (x + xl // abs(xl), y)
		d1 = abs(x1 - xc) + abs(y1 - yc)
		(x2, y2) = (x, y + xs // abs(xs))
		d2 = abs(x2 - xc) + abs(y2 - yc)
		if d1 < d2:
			ans.append([x, y])
			(x, y) = (x1, y1)
			a = a - 1
			if d1 < dis[1]:
				dis = [[x, y], d1]
		else:
			ans.append([x, y])
			b = b - 1
			(x, y) = (x2, y2)
			if d2 < dis[1]:
				dis = [[x, y], d2]
	elif a > 0:
		(x1, y1) = (x + xl // abs(xl), y)
		d1 = abs(x1 - xc) + abs(y1 - yc)
		ans.append([x, y])
		(x, y) = (x1, y1)
		a = a - 1
		if d1 < dis[1]:
			dis = [[x, y], d1]
	else:
		(x2, y2) = (x, y + xs // abs(xs))
		d2 = abs(x2 - xc) + abs(y2 - yc)
		ans.append([x, y])
		b = b - 1
		(x, y) = (x2, y2)
		if d2 < dis[1]:
			dis = [[x, y], d2]
ans.append([x, y])
xxl = xc - dis[0][0]
xxs = yc - dis[0][1]
a = abs(xxl)
b = abs(xxs)
(x, y) = (dis[0][0], dis[0][1])
for i in range(abs(xxl) + abs(xxs)):
	if a > 0:
		(x, y) = (x + xxl // abs(xxl), y)
		a = a - 1
		ans.append([x, y])
	else:
		(x, y) = (x, y + xxs // abs(xxs))
		b = b - 1
		ans.append([x, y])
print(len(ans))
for i in range(len(ans)):
	print(*ans[i])


pos = []
pos.append(list(map(int, input().split())))
pos.append(list(map(int, input().split())))
pos.append(list(map(int, input().split())))
pos.sort(key=lambda x: x[1])
ans = []
for i in range(min(pos[0][0], pos[1][0], pos[2][0]), max(pos[0][0], pos[1][0], pos[2][0]) + 1):
	ans.append([i, pos[1][1]])
if pos[0][1] <= pos[1][1]:
	for i in range(pos[0][1], pos[1][1]):
		ans.append([pos[0][0], i])
else:
	for i in range(pos[1][1] + 1, pos[0][1] + 1):
		ans.append([pos[0][0], i])
if pos[2][1] <= pos[1][1]:
	for i in range(pos[2][1], pos[1][1]):
		ans.append([pos[2][0], i])
else:
	for i in range(pos[1][1] + 1, pos[2][1] + 1):
		ans.append([pos[2][0], i])
print(len(ans))
for i in ans:
	print(i[0], i[1])


xx = []
yy = []
for _ in range(3):
	(a, b) = map(int, input().split())
	xx.append(a)
	yy.append(b)
print(max(xx) - min(xx) + max(yy) - min(yy) + 1)
w = sorted(zip(xx, yy))
for x in range(w[0][0], w[1][0]):
	print(x, w[0][1])
for x in range(w[1][0] + 1, w[2][0] + 1):
	print(x, w[2][1])
for y in range(min(yy), max(yy) + 1):
	print(w[1][0], y)


xc = []
for item in range(3):
	a = [int(x) for x in input().split()]
	xc.append(a)
cx = []
xc.sort()
tot = []
counter = 0
for item in xc:
	cx.append((item[1], item[0]))
	cx.sort()
for item in range(xc[0][0], xc[2][0] + 1):
	tot.append(str(item) + ' ' + str(cx[1][0]))
	counter += 1
if xc[0][1] > cx[1][0]:
	for item in range(cx[1][0] + 1, xc[0][1] + 1):
		tot.append(str(xc[0][0]) + ' ' + str(item))
		counter += 1
elif xc[0][1] < cx[1][0]:
	for item in range(xc[0][1], cx[1][0]):
		tot.append(str(xc[0][0]) + ' ' + str(item))
		counter += 1
if xc[2][1] > cx[1][0]:
	for item in range(cx[1][0] + 1, xc[2][1] + 1):
		tot.append(str(xc[2][0]) + ' ' + str(item))
		counter += 1
elif xc[2][1] < cx[1][0]:
	for item in range(xc[2][1], cx[1][0]):
		tot.append(str(xc[2][0]) + ' ' + str(item))
		counter += 1
if xc[1][1] > cx[1][0]:
	for item in range(cx[1][0] + 1, xc[1][1] + 1):
		tot.append(str(xc[1][0]) + ' ' + str(item))
		counter += 1
elif xc[1][1] < cx[1][0]:
	for item in range(xc[1][1], cx[1][0]):
		tot.append(str(xc[1][0]) + ' ' + str(item))
		counter += 1
print(counter)
for item in tot:
	print(item)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
A_list = {(a[0], a[1])}
for i in range(min(a[0], b[0]), max(a[0], b[0]) + 1):
	A_list.add((i, a[1]))
for i in range(min(a[0], c[0]), max(a[0], c[0]) + 1):
	A_list.add((i, a[1]))
for i in range(min(a[1], b[1]), max(a[1], b[1]) + 1):
	A_list.add((b[0], i))
for i in range(min(a[1], c[1]), max(a[1], c[1]) + 1):
	A_list.add((c[0], i))
B_list = {(b[0], b[1])}
for i in range(min(b[0], a[0]), max(b[0], a[0]) + 1):
	B_list.add((i, b[1]))
for i in range(min(b[0], c[0]), max(b[0], c[0]) + 1):
	B_list.add((i, b[1]))
for i in range(min(a[1], b[1]), max(a[1], b[1]) + 1):
	B_list.add((a[0], i))
for i in range(min(b[1], c[1]), max(b[1], c[1]) + 1):
	B_list.add((c[0], i))
C_list = {(c[0], c[1])}
for i in range(min(c[0], a[0]), max(c[0], a[0]) + 1):
	C_list.add((i, c[1]))
for i in range(min(b[0], c[0]), max(b[0], c[0]) + 1):
	C_list.add((i, c[1]))
for i in range(min(c[1], a[1]), max(c[1], a[1]) + 1):
	C_list.add((a[0], i))
for i in range(min(b[1], c[1]), max(b[1], c[1]) + 1):
	C_list.add((b[0], i))
if len(A_list) < len(B_list):
	ans = A_list
else:
	ans = B_list
if len(C_list) < len(ans):
	ans = C_list
print(len(ans))
for i in ans:
	print(*i)


(x_A, y_A) = list(map(int, input().split()))
(x_B, y_B) = list(map(int, input().split()))
(x_C, y_C) = list(map(int, input().split()))
if x_A >= x_B >= x_C:
	(x_A, x_B, x_C) = (x_C, x_B, x_A)
	(y_A, y_B, y_C) = (y_C, y_B, y_A)
elif x_A >= x_C >= x_B:
	(x_A, x_B, x_C) = (x_B, x_C, x_A)
	(y_A, y_B, y_C) = (y_B, y_C, y_A)
elif x_B >= x_A >= x_C:
	(x_A, x_B, x_C) = (x_C, x_A, x_B)
	(y_A, y_B, y_C) = (y_C, y_A, y_B)
elif x_B >= x_C >= x_A:
	(x_A, x_B, x_C) = (x_A, x_C, x_B)
	(y_A, y_B, y_C) = (y_A, y_C, y_B)
elif x_C >= x_A >= x_B:
	(x_A, x_B, x_C) = (x_B, x_A, x_C)
	(y_A, y_B, y_C) = (y_B, y_A, y_C)
(pos_x, pos_y) = (x_A, min(y_A, y_B, y_C))
count = 0
ans = ''
while pos_x < x_B:
	ans += str(pos_x) + ' ' + str(y_A) + '\n'
	pos_x += 1
	count += 1
while pos_y <= max(y_C, y_A, y_B):
	ans += str(x_B) + ' ' + str(pos_y) + '\n'
	pos_y += 1
	count += 1
while pos_x < x_C:
	pos_x += 1
	ans += str(pos_x) + ' ' + str(y_C) + '\n'
	count += 1
print(count)
print(ans[:-1])


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
mas = [[y1, x1], [y2, x2], [y3, x3]]
mas.sort()
for i in range(3):
	mas[i] = mas[i][::-1]
a = 0
ans = []
for i in range(mas[0][1], mas[1][1]):
	a += 1
	ans.append([mas[0][0], i])
for i in range(mas[2][1], mas[1][1], -1):
	a += 1
	ans.append([mas[2][0], i])
yy = mas[1][1]
mas.sort()
for i in range(mas[0][0], mas[2][0] + 1):
	a += 1
	ans.append([i, yy])
print(a)
for i in range(a):
	print(*ans[i])


def doWay(x, y, x1, y1, x2, y2):
	global answer
	while x < x1 and x < x2:
		x += 1
		answer.add((x, y))
	while y < y1 and y < y2:
		y += 1
		answer.add((x, y))
	while x > x1 and x > x2:
		x -= 1
		answer.add((x, y))
	while y > y1 and y > y2:
		y -= 1
		answer.add((x, y))
xy = list()
xy.append(tuple(map(int, input().split())))
xy.append(tuple(map(int, input().split())))
xy.append(tuple(map(int, input().split())))
answer = set(xy)
doWay(xy[0][0], xy[0][1], xy[1][0], xy[1][1], xy[2][0], xy[2][1])
doWay(xy[1][0], xy[1][1], xy[0][0], xy[0][1], xy[2][0], xy[2][1])
doWay(xy[2][0], xy[2][1], xy[0][0], xy[0][1], xy[1][0], xy[1][1])
print(len(answer))
for (x, y) in answer:
	print(x, y)


def func1(a, b, c, d, e):
	j = max(c, d, e)
	k = min(c, d, e)
	print(j - k + 1 + abs(b - a))
	for i in range(k, j + 1):
		print(str(a) + ' ' + str(i))
	if a < b:
		for i in range(a + 1, b + 1):
			print(str(i) + ' ' + str(e))
	else:
		for i in range(b, a):
			print(str(i) + ' ' + str(e))

def func2(a, b, c, d, e):
	j = max(c, d, e)
	k = min(c, d, e)
	print(j - k + 1 + abs(b - a))
	for i in range(k, j + 1):
		print(str(i) + ' ' + str(a))
	if a < b:
		for i in range(a + 1, b + 1):
			print(str(e) + ' ' + str(i))
	else:
		for i in range(b, a):
			print(str(e) + ' ' + str(i))
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
if x1 == x2 and x2 == x3:
	a = max(y1, y2, y3)
	b = min(y1, y2, y3)
	print(a - b + 1)
	for i in range(b, a + 1):
		print(str(x1) + ' ' + str(i))
elif y1 == y2 and y2 == y3:
	a = max(x1, x2, x3)
	b = min(x1, x2, x3)
	print(a - b + 1)
	for i in range(b, a + 1):
		print(str(i) + ' ' + str(y1))
elif x1 == x2:
	func1(x1, x3, y1, y2, y3)
elif x2 == x3:
	func1(x2, x1, y2, y3, y1)
elif x1 == x3:
	func1(x1, x2, y1, y3, y2)
elif y1 == y2:
	func2(y1, y3, x1, x2, x3)
elif y2 == y3:
	func2(y2, y1, x2, x3, x1)
elif y1 == y3:
	func2(y1, y2, x1, x3, x2)
else:
	l = [(x1, y1), (x2, y2), (x3, y3)]
	l.sort()
	if l[1][1] == max(l[0][1], l[1][1], l[2][1]):
		if l[2][1] - l[0][1] > 0:
			print(l[2][0] - l[0][0] + 1 - l[0][1] + l[1][1])
			for i in range(l[0][0], l[2][0] + 1):
				print(str(i) + ' ' + str(l[2][1]))
			for i in range(l[0][1], l[2][1]):
				print(str(l[0][0]) + ' ' + str(i))
			for i in range(l[2][1] + 1, l[1][1] + 1):
				print(str(l[1][0]) + ' ' + str(i))
		else:
			print(l[2][0] - l[0][0] + 1 - l[2][1] + l[1][1])
			for i in range(l[0][0], l[2][0] + 1):
				print(str(i) + ' ' + str(l[0][1]))
			for i in range(l[2][1], l[0][1]):
				print(str(l[2][0]) + ' ' + str(i))
			for i in range(l[0][1] + 1, l[1][1] + 1):
				print(str(l[1][0]) + ' ' + str(i))
	elif l[1][1] == min(l[0][1], l[1][1], l[2][1]):
		if l[2][1] - l[0][1] > 0:
			print(l[2][0] - l[0][0] + 1 - l[1][1] + l[2][1])
			for i in range(l[0][0], l[2][0] + 1):
				print(str(i) + ' ' + str(l[0][1]))
			for i in range(l[1][1], l[0][1]):
				print(str(l[1][0]) + ' ' + str(i))
			for i in range(l[0][1] + 1, l[2][1] + 1):
				print(str(l[2][0]) + ' ' + str(i))
		else:
			print(l[2][0] - l[0][0] + 1 - l[1][1] + l[0][1])
			for i in range(l[0][0], l[2][0] + 1):
				print(str(i) + ' ' + str(l[2][1]))
			for i in range(l[1][1], l[2][1]):
				print(str(l[1][0]) + ' ' + str(i))
			for i in range(l[2][1] + 1, l[0][1] + 1):
				print(str(l[0][0]) + ' ' + str(i))
	elif l[2][1] - l[0][1] > 0:
		print(l[2][0] - l[0][0] + l[2][1] - l[0][1] + 1)
		for i in range(l[0][1], l[1][1]):
			print(str(l[0][0]) + ' ' + str(i))
		for i in range(l[0][0], l[2][0]):
			print(str(i) + ' ' + str(l[1][1]))
		for i in range(l[1][1], l[2][1] + 1):
			print(str(l[2][0]) + ' ' + str(i))
	else:
		print(l[2][0] - l[0][0] + l[0][1] - l[2][1] + 1)
		for i in range(l[2][1], l[1][1] + 1):
			print(str(l[2][0]) + ' ' + str(i))
		for i in range(l[0][0], l[2][0]):
			print(str(i) + ' ' + str(l[1][1]))
		for i in range(l[1][1] + 1, l[0][1] + 1):
			print(str(l[0][0]) + ' ' + str(i))


import sys
from io import StringIO
from atexit import register
BUFFER = StringIO(sys.stdin.read())

def input():
	return BUFFER.readline().rstrip()
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def Rdi():
	return int(input())

def Rd(f=int):
	return [f(x) for x in input().split()]

def PrintF(arr):
	return ' '.join(('{:.10f}'.format(x) for x in arr))

def Debug(x):
	print('\x1b[0;31m{}\x1b[0m'.format(x), file=sys.stderr)
co = [Rd(), Rd(), Rd()]
co.sort()
(xA, yA) = co[0]
(xB, yB) = co[1]
(xC, yC) = co[2]
ans = set([tuple(c) for c in co])
tmp = xA
while tmp < xB:
	tmp += 1
	new = (tmp, yA)
	ans.add(new)
tmp = yA
while tmp < yB:
	tmp += 1
	new = (xB, tmp)
	ans.add(new)
while tmp > yB:
	tmp -= 1
	new = (xB, tmp)
	ans.add(new)
lo = min(yA, yB)
hi = max(yA, yB)
while lo > yC:
	lo -= 1
	new = (xB, lo)
	ans.add(new)
while hi < yC:
	hi += 1
	new = (xB, hi)
	ans.add(new)
tmp = xB
while tmp < xC:
	tmp += 1
	new = (tmp, yC)
	ans.add(new)
print(len(ans))
for a in ans:
	print(*a)


def get_path_hv(A, B):
	(x, y) = A
	path = [(x, y)]
	while x < B[0]:
		x += 1
		path.append((x, y))
	while x > B[0]:
		x -= 1
		path.append((x, y))
	while y < B[1]:
		y += 1
		path.append((x, y))
	while y > B[1]:
		y -= 1
		path.append((x, y))
	return path

def get_path_vh(A, B):
	(x, y) = A
	path = [(x, y)]
	while y < B[1]:
		y += 1
		path.append((x, y))
	while y > B[1]:
		y -= 1
		path.append((x, y))
	while x < B[0]:
		x += 1
		path.append((x, y))
	while x > B[0]:
		x -= 1
		path.append((x, y))
	return path
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
C = tuple(map(int, input().split()))
paths = []
paths.append([get_path_vh(A, B), get_path_hv(A, B)])
paths.append([get_path_vh(C, B), get_path_hv(C, B)])
paths.append([get_path_vh(A, C), get_path_hv(A, C)])
ans = 10 ** 8
ans_path = []
for i in range(3):
	for j in range(3):
		if i != j:
			for a in paths[i]:
				for b in paths[j]:
					X = list(set([*a, *b]))
					if len(X) < ans:
						ans = len(X)
						ans_path = X
print(ans)
for p in ans_path:
	print(*p)


points = []
mx = 0
for i in range(3):
	points.append(list(map(int, input().split())))
points = sorted(points, key=lambda x: x[0])
k = 1
(x, y) = (points[0][0], points[0][1])
(x2, y2) = (points[1][0], points[1][1])
coor = [[points[0][0], points[0][1]]]
mx = y
mn = y
while True:
	if x < x2:
		x += 1
	elif y < y2:
		y += 1
		mx = y
	elif y > y2:
		y -= 1
		mn = y
	else:
		break
	k += 1
	coor.append([x, y])
(x3, y3) = (points[2][0], points[2][1])
if mn <= y3 <= mx:
	y = y3
elif y3 < mn:
	y = mn
elif y3 > mx:
	y = mx
while True:
	if y < y3:
		y += 1
	elif y > y3:
		y -= 1
	elif x < x3:
		x += 1
	else:
		break
	k += 1
	coor.append([x, y])
print(k)
for i in coor:
	print(*i)


koor = dict()
a = input()
xa = int(a.split()[0])
ya = int(a.split()[1])
b = input()
xb = int(b.split()[0])
yb = int(b.split()[1])
c = input()
xc = int(c.split()[0])
yc = int(c.split()[1])
koor[ya] = xa
koor[yb] = xb
koor[yc] = xc
print(max(xa, xb, xc) + max(ya, yb, yc) - min(xa, xb, xc) - min(ya, yb, yc) + 1)
for i in range(max(xa, xb, xc) - min(xa, xb, xc) + 1):
	print(min(xa, xb, xc) + i, ya + yb + yc - min(ya, yb, yc) - max(ya, yb, yc))
for i in range(max(ya, yb, yc) - (ya + yb + yc - min(ya, yb, yc) - max(ya, yb, yc))):
	print(koor[max(ya, yb, yc)], max(ya, yb, yc) - i)
for i in range(-min(ya, yb, yc) + (ya + yb + yc - min(ya, yb, yc) - max(ya, yb, yc))):
	print(koor[min(ya, yb, yc)], min(ya, yb, yc) + i)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
(a, b, c) = sorted([a, b, c])
ans = []
for i in range(min(a[1], b[1], c[1]), max(a[1], b[1], c[1]) + 1):
	ans.append((b[0], i))
for i in range(a[0], b[0] + 1):
	ans.append((i, a[1]))
for i in range(b[0], c[0] + 1):
	ans.append((i, c[1]))
ans = set(ans)
print(len(ans))
for i in ans:
	print(*i)


xy1 = list(map(int, input().split(' ')))
xy2 = list(map(int, input().split(' ')))
xy3 = list(map(int, input().split(' ')))
x = max(abs(xy1[0] - xy2[0]), abs(xy3[0] - xy2[0]), abs(xy3[0] - xy1[0]))
y = max(abs(xy1[1] - xy2[1]), abs(xy3[1] - xy2[1]), abs(xy3[1] - xy1[1]))
r = x + y + 1

def sortlist(l1, l2, l3):
	if l1[0] <= l2[0] <= l3[0]:
		return [l1, l2, l3]
	if l2[0] < l1[0] <= l3[0]:
		return [l2, l1, l3]
	if l3[0] < l2[0] < l1[0]:
		return [l3, l2, l1]
	if l1[0] <= l3[0] < l2[0]:
		return [l1, l3, l2]
	if l2[0] <= l3[0] < l1[0]:
		return [l2, l3, l1]
	if l3[0] < l1[0] <= l2[0]:
		return [l3, l1, l2]
result = []
xy_list = sortlist(xy1, xy2, xy3)
for i in range(xy_list[0][0], xy_list[1][0] + 1):
	if [i, xy_list[0][1]] not in result:
		result.append([i, xy_list[0][1]])
for j in range(min(xy_list[0][1], xy_list[2][1], xy_list[1][1]), max(xy_list[0][1], xy_list[2][1], xy_list[2][1], xy_list[1][1]) + 1):
	if [xy_list[1][0], j] not in result:
		result.append([xy_list[1][0], j])
for k in range(xy_list[1][0] + 1, xy_list[2][0] + 1):
	if [k, xy_list[2][1]] not in result:
		result.append([k, xy_list[2][1]])
print(r)
for l in result:
	print(l[0], l[1])


friends = []
for i in range(3):
	(X, Y) = map(int, input().split())
	friends.append((X, Y))
result = []
friends = sorted(friends)
for i in range(friends[0][0], friends[1][0]):
	result.append((i, friends[0][1]))
for i in range(friends[1][0] + 1, friends[2][0] + 1):
	result.append((i, friends[2][1]))
mean_x = friends[1][0]
friends = sorted(friends, key=lambda x: x[1])
for i in range(friends[0][1], friends[2][1] + 1):
	result.append((mean_x, i))
print(len(result))
for item in result:
	print(item[0], item[1])


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
lx = sorted([x1, x2, x3])
ly = sorted([y1, y2, y3])
tx = lx[1]
ty = ly[1]
(zx, zy) = (tx, ty)
p = abs(tx - x1) + abs(ty - y1) + abs(tx - x2) + abs(ty - y2) + abs(tx - x3) + abs(ty - y3) + 1
print(p)
print(tx, ty)
while x1 != zx or y1 != zy:
	if zx < x1:
		zx = zx + 1
	elif zx > x1:
		zx = zx - 1
	elif zy < y1:
		zy = zy + 1
	elif zy > y1:
		zy = zy - 1
	print(zx, zy)
(zx, zy) = (tx, ty)
while x2 != zx or y2 != zy:
	if zx < x2:
		zx = zx + 1
	elif zx > x2:
		zx = zx - 1
	elif zy < y2:
		zy = zy + 1
	elif zy > y2:
		zy = zy - 1
	print(zx, zy)
(zx, zy) = (tx, ty)
while x3 != zx or y3 != zy:
	if zx < x3:
		zx = zx + 1
	elif zx > x3:
		zx = zx - 1
	elif zy < y3:
		zy = zy + 1
	elif zy > y3:
		zy = zy - 1
	print(zx, zy)


import math
A = [[0] * 1001 for i in range(1001)]
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
xm = x1 + x2 + x3 - max(x1, x2, x3) - min(x1, x2, x3)
ym = y1 + y2 + y3 - max(y1, y2, y3) - min(y1, y2, y3)
print(max(x1, x2, x3) - min(x1, x2, x3) + max(y1, y2, y3) - min(y1, y2, y3) + 1)
for i in range(min(x1, xm), max(x1, xm) + 1):
	if A[i][y1] != 1:
		A[i][y1] = 1
		print(i, y1)
for j in range(min(y1, ym), max(y1, ym) + 1):
	if A[xm][j] != 1:
		A[xm][j] = 1
		print(xm, j)
for i in range(min(x2, xm), max(x2, xm) + 1):
	if A[i][y2] != 1:
		A[i][y2] = 1
		print(i, y2)
for j in range(min(y2, ym), max(y2, ym) + 1):
	if A[xm][j] != 1:
		A[xm][j] = 1
		print(xm, j)
for i in range(min(x3, xm), max(x3, xm) + 1):
	if A[i][y3] != 1:
		A[i][y3] = 1
		print(i, y3)
for j in range(min(y3, ym), max(y3, ym) + 1):
	if A[xm][j] != 1:
		A[xm][j] = 1
		print(xm, j)


coords1 = tuple(map(int, input().split()))
coords2 = tuple(map(int, input().split()))
coords3 = tuple(map(int, input().split()))
coords = [coords1, coords2, coords3]
coords.sort(key=lambda x: x[0])

def min_path(coords_lm, coords_rm, coords_center):
	first_path = []
	second_path = []
	first_path.append(tuple(coords_lm))
	while first_path[-1][0] != coords_center[0]:
		new_square = (first_path[-1][0] + 1, first_path[-1][1])
		first_path.append(new_square)
	orient = 1 if first_path[-1][1] < coords_center[1] else -1
	while first_path[-1][1] != coords_center[1]:
		new_square = (first_path[-1][0], first_path[-1][1] + 1 * orient)
		first_path.append(new_square)
	second_path.append(tuple(coords_rm))
	while second_path[-1][0] != coords_center[0]:
		new_square = (second_path[-1][0] - 1, second_path[-1][1])
		second_path.append(new_square)
	orient = 1 if second_path[-1][1] < coords_center[1] else -1
	while second_path[-1][1] != coords_center[1]:
		new_square = (second_path[-1][0], second_path[-1][1] + 1 * orient)
		second_path.append(new_square)
	return set(first_path).union(set(second_path))
path = min_path(coords[0], coords[2], coords[1])
path = list(map(lambda x: ' '.join((str(x[0]), str(x[1]))), list(path)))
print(len(path))
print('\n'.join(path))


def prov(y1, y2, y3):
	if (abs(y1 - y2), abs(y1 - y3)) <= (abs(y2 - y1), abs(y2 - y3)) and (abs(y1 - y2), abs(y1 - y3)) <= (abs(y3 - y2), abs(y3 - y1)):
		return y1
	if (abs(y2 - y1), abs(y2 - y3)) <= (abs(y1 - y2), abs(y1 - y3)) and (abs(y2 - y1), abs(y2 - y3)) <= (abs(y3 - y2), abs(y3 - y1)):
		return y2
	if (abs(y3 - y2), abs(y3 - y1)) <= (abs(y1 - y2), abs(y1 - y3)) and (abs(y3 - y2), abs(y3 - y1)) <= (abs(y2 - y1), abs(y2 - y3)):
		return y3
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
(x3, y3) = list(map(int, input().split()))
arr = []
for i in range(max(y1, y2, y3) + 1):
	arr.append([-1] * (max(x1, x2, x3) + 1))
xj = prov(x1, x2, x3)
yi = prov(y1, y2, y3)
stx1 = min(x1, xj)
fix1 = max(x1, xj)
se = set()
for i in range(stx1, fix1 + 1):
	se.add((i, y1))
sty1 = min(y1, yi)
fiy1 = max(y1, yi)
for i in range(sty1, fiy1 + 1):
	se.add((xj, i))
stx2 = min(x2, xj)
fix2 = max(x2, xj)
for i in range(stx2, fix2 + 1):
	se.add((i, y2))
sty2 = min(y2, yi)
fiy2 = max(y2, yi)
for i in range(sty2, fiy2 + 1):
	se.add((xj, i))
stx3 = min(x3, xj)
fix3 = max(x3, xj)
for i in range(stx3, fix3 + 1):
	se.add((i, y3))
sty3 = min(y3, yi)
fiy3 = max(y3, yi)
for i in range(sty3, fiy3 + 1):
	se.add((xj, i))
print(len(se))
se = list(se)
for i in range(len(se)):
	print(se[i][0], se[i][1])


p = list()
for _ in range(3):
	(a, b) = map(int, input().split())
	p.append([a, b])
p.sort()
maxX = max(max(p[1][0], p[2][0]), p[0][0])
minX = min(min(p[1][0], p[2][0]), p[0][0])
maxY = max(max(p[1][1], p[2][1]), p[0][1])
minY = min(min(p[1][1], p[2][1]), p[0][1])
print(maxX - minX + maxY - minY + 1)
maxX = max(p[1][0], p[2][0])
minX = min(p[1][0], p[2][0])
path = set()
for i in range(p[0][0], minX + 1):
	path.add((i, p[0][1]))
for i in range(minY, maxY + 1):
	path.add((minX, i))
maxY = max(p[1][1], p[2][1])
if p[1][0] == maxX and p[1][1] == maxY or (p[2][0] == maxX and p[2][1] == maxY):
	selectY = maxY
else:
	selectY = min(p[1][1], p[2][1])
for i in range(minX, maxX + 1):
	path.add((i, selectY))
for x in path:
	print(x[0], x[1])


import sys
from math import floor, ceil
r = lambda : sys.stdin.readline().strip()
a = [[0] * 2 for i in range(3)]

def abs(x):
	if x < 0:
		x = -x
	return x

def calcLen(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2) + 1

def main():
	(a[0][0], a[0][1]) = map(int, r().split())
	(a[1][0], a[1][1]) = map(int, r().split())
	(a[2][0], a[2][1]) = map(int, r().split())
	xMax = max(a[0][0], a[1][0], a[2][0])
	xMin = min(a[0][0], a[1][0], a[2][0])
	yMax = max(a[0][1], a[1][1], a[2][1])
	yMin = min(a[0][1], a[1][1], a[2][1])
	pathLen = xMax - xMin + yMax - yMin + 1
	for i in range(3):
		for j in range(3):
			px = a[i][0]
			py = a[j][1]
			sum = 0
			for k in range(3):
				sum += calcLen(a[k][0], a[k][1], px, py)
			sum -= 2
			if sum == pathLen:
				break
		if sum == pathLen:
			break
	sq = [[0] * (yMax + 1) for i in range(xMax + 1)]
	for i in range(3):
		if px == a[i][0]:
			c = -1
			if py > a[i][1]:
				c = 1
			for j in range(a[i][1], py, c):
				sq[px][j] = 1
		elif py == a[i][1]:
			c = -1
			if px > a[i][0]:
				c = 1
			for j in range(a[i][0], px, c):
				sq[j][py] = 1
		else:
			c = -1
			if py > a[i][1]:
				c = 1
			for j in range(a[i][1], py + c, c):
				sq[a[i][0]][j] = 1
			c = -1
			if px > a[i][0]:
				c = 1
			for j in range(a[i][0], px, c):
				sq[j][py] = 1
	sq[px][py] = 1
	ans = []
	for i in range(xMax + 1):
		for j in range(yMax + 1):
			if sq[i][j] == 1:
				ans.append((i, j))
	print(len(ans))
	for i in ans:
		print(i[0], i[1])
main()


def main():
	a = tuple(map(int, input().split()))
	b = tuple(map(int, input().split()))
	c = tuple(map(int, input().split()))
	(a, b, c) = sorted((a, b, c))
	(x1, y1) = a
	(x2, y2) = b
	(x3, y3) = c
	dy2 = y2 - y1
	dy3 = y3 - y1
	sy2 = 1 if dy2 >= 0 else -1
	sy3 = 1 if dy3 >= 0 else -1
	ay2 = abs(dy2)
	ay3 = abs(dy3)
	c = 0
	res = []
	if sy2 == sy3:
		for i in range(x1, x2 + 1):
			c += 1
			res.append((i, y1))
		for i in range(1, max(ay2, ay3) + 1):
			c += 1
			res.append((x2, y1 + sy2 * i))
		for i in range(x2 + 1, x3 + 1):
			c += 1
			res.append((i, y3))
	else:
		for i in range(x1, x3 + 1):
			c += 1
			res.append((i, y1))
		for i in range(1, ay2 + 1):
			c += 1
			res.append((x2, y1 + sy2 * i))
		for i in range(1, ay3 + 1):
			c += 1
			res.append((x3, y1 + sy3 * i))
	print(c)
	for (x, y) in res:
		print(x, y)
main()


(xa, ya) = map(int, input().split())
(xb, yb) = map(int, input().split())
(xc, yc) = map(int, input().split())
xs = [xa, xb, xc]
xs.sort()
ys = [ya, yb, yc]
ys.sort()
(mx, my) = (xs[1], ys[1])
field = [[False] * 1001 for _ in range(1001)]
for (sx, sy) in [(xa, ya), (xb, yb), (xc, yc)]:
	for x in range(min(sx, mx), max(sx, mx) + 1):
		field[x][sy] = True
	for y in range(min(sy, my), max(sy, my) + 1):
		field[mx][y] = True
ans = []
for x in range(1001):
	for y in range(1001):
		if field[x][y]:
			ans.append((x, y))
print(len(ans))
for (x, y) in ans:
	print(x, y)


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

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

def li():
	return list(mi())
a = [tuple(mi()) for i in range(3)]
a.sort()
up1 = a[1][1] >= a[0][1]
up2 = a[2][1] >= a[0][1]
ans = {a[0]}
(x, y) = a[0]
if up1 and up2:
	while y < min(a[1][1], a[2][1]):
		y += 1
		ans.add((x, y))
	while x < a[2][0]:
		x += 1
		ans.add((x, y))
	(hx, hy) = a[2] if a[2][1] > a[1][1] else a[1]
	while hy > y:
		ans.add((hx, hy))
		hy -= 1
else:
	dn1 = a[1][1] <= a[0][1]
	dn2 = a[2][1] <= a[0][1]
	ans = {a[0]}
	(x, y) = a[0]
	if dn1 and dn2:
		while y > max(a[1][1], a[2][1]):
			y -= 1
			ans.add((x, y))
		while x < a[2][0]:
			x += 1
			ans.add((x, y))
		(lx, ly) = a[2] if a[2][1] < a[1][1] else a[1]
		while ly < y:
			ans.add((lx, ly))
			ly += 1
	else:
		(x, y) = a[0]
		ans = {a[0]}
		while x < a[2][0]:
			x += 1
			ans.add((x, y))
		dy = 1 if a[1][1] <= a[0][1] else -1
		(xx, yy) = a[1]
		while yy != a[0][1]:
			ans.add((xx, yy))
			yy += dy
		dy = 1 if a[2][1] <= a[0][1] else -1
		(xx, yy) = a[2]
		while yy != a[0][1]:
			ans.add((xx, yy))
			yy += dy
ans = sorted(ans)
print(len(ans))
print('\n'.join(('%d %d' % (x, y) for (x, y) in ans)))


l = []
(a, b) = map(int, input().split())
l.append((a, b))
(a, b) = map(int, input().split())
l.append((a, b))
(a, b) = map(int, input().split())
l.append((a, b))
l.sort()
path = []
path.append(l[0])
x = l[0][0]
while x < l[1][0]:
	path.append((x, l[0][1]))
	x = x + 1
up = False
if l[0][1] < l[1][1]:
	up = True
if up:
	y = l[0][1]
	while y <= l[1][1]:
		path.append((l[1][0], y))
		y = y + 1
else:
	y = l[0][1]
	while y >= l[1][1]:
		path.append((l[1][0], y))
		y = y - 1
up = False
if l[1][1] < l[2][1]:
	up = True
if up:
	y = l[1][1]
	while y <= l[2][1]:
		path.append((l[1][0], y))
		y = y + 1
else:
	y = l[1][1]
	while y >= l[2][1]:
		path.append((l[1][0], y))
		y = y - 1
x = l[1][0]
while x < l[2][0]:
	path.append((x, l[2][1]))
	x = x + 1
path.append(l[2])
path = list(set(path))
print(len(path))
for i in range(len(path)):
	print(str(path[i][0]) + ' ' + str(path[i][1]))


(xa, ya) = map(int, input().split())
(xb, yb) = map(int, input().split())
(xc, yc) = map(int, input().split())
srx = xa + xb + xc - min(xa, xb, xc) - max(xa, xb, xc)
sry = ya + yb + yc - min(ya, yb, yc) - max(ya, yb, yc)
l = max(xa, xb, xc) - min(xa, xb, xc) + max(ya, yb, yc) - min(ya, yb, yc) + 1
print(l)
for i in range(min(xa, xb, xc), max(xa, xb, xc) + 1):
	print(i, sry)
if ya != sry:
	i = ya
	while i != sry:
		print(xa, i)
		i += int((sry - ya) / abs(sry - ya))
if yb != sry:
	i = yb
	while i != sry:
		print(xb, i)
		i += int((sry - yb) / abs(sry - yb))
if yc != sry:
	i = yc
	while i != sry:
		print(xc, i)
		i += int((sry - yc) / abs(sry - yc))


def connect(x1, y1, x2, y2):
	a = set()
	if x2 > x1:
		for i in range(x1, x2 + 1):
			a.add((i, y1))
		if y2 > y1:
			for j in range(y1, y2 + 1):
				a.add((x2, j))
		else:
			for j in range(y2, y1 + 1):
				a.add((x2, j))
	else:
		for i in range(x2, x1 + 1):
			a.add((i, y2))
		if y2 > y1:
			for j in range(y1, y2 + 1):
				a.add((x1, j))
		else:
			for j in range(y2, y1 + 1):
				a.add((x1, j))
	return a
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
a = connect(x1, y1, x2, y2)
b = connect(x1, y1, x3, y3)
c = connect(x3, y3, x2, y2)
ans = a.union(b)
for ai in a:
	t = connect(*ai, x3, y3)
	if len(a.union(t)) < len(ans):
		ans = a.union(t)
for ai in b:
	t = connect(*ai, x2, y2)
	if len(b.union(t)) < len(ans):
		ans = b.union(t)
for ai in c:
	t = connect(*ai, x1, y1)
	if len(c.union(t)) < len(ans):
		ans = c.union(t)
print(len(ans))
for ps in ans:
	print(*ps)


(xa, ya) = [int(k) for k in input().split()]
(xb, yb) = [int(k) for k in input().split()]
(xc, yc) = [int(k) for k in input().split()]
D = {}
D[xa] = ya
D[xb] = yb
D[xc] = yc
X = [xa, xb, xc]
Y = [ya, yb, yc]
X.sort()
Y.sort()
ans = X[2] - X[0] + Y[2] - Y[0] + 1
print(ans)
for i in range(Y[0], Y[2] + 1):
	print(X[1], i)
for i in range(X[0], X[1]):
	print(i, D[X[0]])
for i in range(X[1] + 1, X[2] + 1):
	print(i, D[X[2]])


def put(x1, y1, x2, y2):
	mass2 = []
	if y1 == y2:
		for i in range(x1 + 1, x2):
			mass2.append((i, y1))
	elif y2 > y1:
		for i in range(x1 + 1, x2 + 1):
			mass2.append((i, y1))
		for i in range(y1 + 1, y2):
			mass2.append((x2, i))
	else:
		for i in range(x1 + 1, x2 + 1):
			mass2.append((i, y1))
		for i in range(y2 + 1, y1):
			mass2.append((x2, i))
	return mass2

def best(x1, y1, x2, y2, x3, y3):
	mass = []
	mass += put(x1, y1, x2, y2)
	if y2 > y1:
		if y3 > y2:
			mass += put(x2, y2, x3, y3)
		elif y3 <= y2 and y3 >= y1:
			mass += put(x2, y3, x3, y3)
		else:
			mass += put(x2, y1, x3, y3)
	elif y2 == y1:
		mass += put(x2, y2, x3, y3)
	elif y3 > y1:
		mass += put(x2, y1, x3, y3)
	elif y3 <= y1 and y3 >= y2:
		mass += put(x2, y3, x3, y3)
	else:
		mass += put(x2, y2, x3, y3)
	for i in [(x1, y1), (x2, y2), (x3, y3)]:
		if i not in mass:
			mass.append(i)
	print(len(mass))
	for i in mass:
		print(*i)
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
a = [(x1, y1), (x2, y2), (x3, y3)]
a.sort()
c = best(a[0][0], a[0][1], a[1][0], a[1][1], a[2][0], a[2][1])


def solve(r, t):
	if r < k:
		for i in range(r, k + 1):
			matrix[i][t] = 1
	else:
		for i in range(k, r + 1):
			matrix[i][t] = 1
	if t < l:
		for i in range(t, l + 1):
			matrix[k][i] = 1
	else:
		for i in range(l, t + 1):
			matrix[k][i] = 1
((a, b), (m, n), (x, y)) = (map(int, input().split()), map(int, input().split()), map(int, input().split()))
(hmax, hmin, wmax, wmin) = (max((a, m, x)), min((a, m, x)), max((b, n, y)), min((b, n, y)))
matrix = [[0 for i in range(wmax + 1)] for j in range(hmax + 1)]
print(hmax - hmin + wmax - wmin + 1)
(k, l) = (a + m + x - (hmax + hmin), b + n + y - (wmax + wmin))
solve(a, b)
solve(m, n)
solve(x, y)
for i in range(len(matrix)):
	for j in range(len(matrix[i])):
		if matrix[i][j]:
			print(i, j)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def answer(ax, ay, bx, by, cx, cy):
	journey = [[ax, ay]]
	distb = abs(ax - bx) + abs(ay - by)
	distc = abs(ax - cx) + abs(ay - cy)
	while ax != bx or ay != by:
		tempcor = [[ax + 1, ay], [ax, ay + 1], [ax - 1, ay], [ax, ay - 1]]
		for i in range(4):
			f = 0
			if tempcor[i][0] >= 0 and tempcor[i][1] >= 0:
				ndistb = abs(tempcor[i][0] - bx) + abs(tempcor[i][1] - by)
				ndistc = abs(tempcor[i][0] - cx) + abs(tempcor[i][1] - cy)
				if ndistb < distb and ndistc < distc:
					ax = tempcor[i][0]
					ay = tempcor[i][1]
					distb = ndistb
					distc = ndistc
					f = 1
					break
				elif ndistb < distb:
					tax = tempcor[i][0]
					tay = tempcor[i][1]
					tdistb = ndistb
					tdistc = ndistc
		if f == 0:
			ax = tax
			ay = tay
			distb = tdistb
			distc = tdistc
		journey.append([ax, ay])
	md = 999999999999999999
	for plot in journey:
		distfromc = abs(cx - plot[0]) + abs(cy - plot[1])
		if distfromc < md:
			md = distfromc
			kahase = plot
	(ax, ay) = kahase
	distc = abs(ax - cx) + abs(ay - cy)
	while ax != cx or ay != cy:
		tempcor = [[ax + 1, ay], [ax, ay + 1], [ax - 1, ay], [ax, ay - 1]]
		for i in range(4):
			f = 0
			if tempcor[i][0] >= 0 and tempcor[i][1] >= 0:
				ndistc = abs(tempcor[i][0] - cx) + abs(tempcor[i][1] - cy)
				if ndistc < distc:
					ax = tempcor[i][0]
					ay = tempcor[i][1]
					distc = ndistc
					f = 1
					break
		journey.append([ax, ay])
	return journey

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(ax, ay) = ria()
		(bx, by) = ria()
		(cx, cy) = ria()
		answer1 = answer(ax, ay, bx, by, cx, cy)
		answer2 = answer(ax, ay, cx, cy, bx, by)
		answer3 = answer(bx, by, cx, cy, ax, ay)
		m = 9999999999999999999999999999
		for i in [answer1, answer2, answer3]:
			if len(i) < m:
				ans = i
				m = len(i)
		wi(m)
		for i in ans:
			wia(i)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def path(a, b):
	(x, y) = a
	(fx, fy) = b
	(f1, f2) = (1, 1)
	if fx < x:
		f1 = -1
	if fy < y:
		f2 = -1
	(p1, p2) = ([], [])
	for i in range(x, fx + f1, f1):
		p1.append([i, y])
	for i in range(y + f2, fy + f2, f2):
		p1.append([fx, i])
	for i in range(y, fy + f2, f2):
		p2.append([x, i])
	for i in range(x + f1, fx + f1, f1):
		p2.append([i, fy])
	return (p1, p2)

def merge(p1, p2):
	p3 = p1[:]
	for i in p2:
		if i not in p3:
			p3.append(i)
	return p3
l = []
for i in range(3):
	l.append(list(map(int, input().split())))
l.sort()
(p1, p2) = path(l[0], l[1])
(p3, p4) = path(l[1], l[2])
p5 = merge(p1, p3)
p6 = merge(p1, p4)
if len(p6) < len(p5):
	p5 = p6[:]
p6 = merge(p2, p3)
if len(p6) < len(p5):
	p5 = p6[:]
p6 = merge(p2, p4)
if len(p6) < len(p5):
	p5 = p6[:]
print(len(p5))
for i in p5:
	print(*i)


def calc(a, b):
	result = abs(a[0] - b[0]) + abs(a[1] - b[1]) + 1
	return result

def solve(a, b, c):
	new = []
	xmin = min(a[0], b[0])
	xmax = max(a[0], b[0])
	if c[0] <= xmax and c[0] >= xmin:
		new.append(c[0])
	elif abs(a[0] - c[0]) < abs(b[0] - c[0]):
		new.append(a[0])
	else:
		new.append(b[0])
	ymin = min(a[1], b[1])
	ymax = max(a[1], b[1])
	if c[1] <= ymax and c[1] >= ymin:
		new.append(c[1])
	elif abs(a[1] - c[1]) < abs(b[1] - c[1]):
		new.append(a[1])
	else:
		new.append(b[1])
	res = calc(a, b) + calc(new, c) - 1
	print(res)
	printmap(a, new)
	printmap(b, new)
	printmap(c, new)
	print('{} {}'.format(new[0], new[1]))

def printmap(a, b):
	if b[0] > a[0]:
		for i in range(a[0], b[0]):
			print('{} {}'.format(i, a[1]))
	else:
		for i in range(a[0], b[0], -1):
			print('{} {}'.format(i, a[1]))
	if b[1] > a[1]:
		for i in range(a[1], b[1]):
			print('{} {}'.format(b[0], i))
	else:
		for i in range(a[1], b[1], -1):
			print('{} {}'.format(b[0], i))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
solve(a, b, c)


def solve(x1, x2, y1, y2):
	ans.add((x1, y1))
	while x1 != x2 or y1 != y2:
		if x1 < x2:
			x1 += 1
			ans.add((x1, y1))
		elif x1 > x2:
			x1 -= 1
			ans.add((x1, y1))
		if y1 < y2:
			y1 += 1
			ans.add((x1, y1))
		elif y1 > y2:
			y1 -= 1
			ans.add((x1, y1))
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
ans = set()
x = sorted([x1, x2, x3])[1]
y = sorted([y1, y2, y3])[1]
solve(x, x1, y, y1)
solve(x, x2, y, y2)
solve(x, x3, y, y3)
print(len(ans))
for row in ans:
	print(*row)


(xa, ya) = list(map(int, input().split()))
(xb, yb) = list(map(int, input().split()))
(xc, yc) = list(map(int, input().split()))
a = []
(x1, y1) = (xa, ya)
for x in range(min(xa, xb), max(xa, xb) + 1):
	for y in range(min(ya, yb), max(ya, yb) + 1):
		if abs(x - xc) + abs(y - yc) < abs(x1 - xc) + abs(y1 - yc):
			(x1, y1) = (x, y)
(x, y) = (x1, y1)
for i in range(min(x, xa), max(x, xa) + 1):
	a.append([i, ya])
for i in range(min(y, ya), max(y, ya) + 1):
	a.append([x, i])
for i in range(min(x, xb), max(x, xb) + 1):
	a.append([i, yb])
for i in range(min(y, yb), max(y, yb) + 1):
	a.append([x, i])
for i in range(min(x, xc), max(x, xc) + 1):
	a.append([i, yc])
for i in range(min(y, yc), max(y, yc) + 1):
	a.append([x, i])
a.sort()
a1 = []
for i in range(1, len(a)):
	if a[i] != a[i - 1]:
		a1.append(a[i - 1])
a1.append(a[-1])
print(len(a1))
for i in a1:
	print(*i)


(xa, ya) = map(int, input().split())
(xb, yb) = map(int, input().split())
(xc, yc) = map(int, input().split())
if (xb, yb) < (xa, ya):
	(xa, ya, xb, yb) = (xb, yb, xa, ya)
if (xc, yc) < (xa, ya):
	(xa, ya, xc, yc) = (xc, yc, xa, ya)
if xb > xc:
	(xb, yb, xc, yc) = (xc, yc, xb, yb)
d = 1 if ya <= yc else -1
if ya <= yb <= yc or ya >= yb >= yc:
	print(xc - xa + abs(yc - ya) + 1)
	for x in range(xa, xb):
		print(x, ya)
	for y in range(ya, yc, d):
		print(xb, y)
	for x in range(xb, xc + 1):
		print(x, yc)
elif yb < min(ya, yc):
	print(xc - xa + max(ya, yc) - yb + 1)
	for x in range(xa, xc + 1):
		print(x, min(ya, yc))
	for y in range(yb, min(ya, yc)):
		print(xb, y)
	if ya < yc:
		for y in range(ya + 1, yc + 1):
			print(xc, y)
	else:
		for y in range(yc + 1, ya + 1):
			print(xa, y)
else:
	print(xc - xa + yb - min(ya, yc) + 1)
	for x in range(xa, xc + 1):
		print(x, max(ya, yc))
	for y in range(max(ya, yc) + 1, yb + 1):
		print(xb, y)
	if ya < yc:
		for y in range(ya, yc):
			print(xa, y)
	else:
		for y in range(yc, ya):
			print(xc, y)


def prm(a, b):
	ld = (min(a[0], b[0]), min(a[1], b[1]))
	ru = (max(a[0], b[0]), max(a[1], b[1]))
	return tuple((ld, ru))

def peres(a, b):
	return tuple(((max(a[0][0], b[0][0]), max(a[0][1], b[0][1])), (min(a[1][0], b[1][0]), min(a[1][1], b[1][1]))))

def rst(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1]) + 1

def printt(a):
	global h
	if h != a:
		print(*a)
	s1 = set([])
	for i in range(min(a[0], h[0]), max(a[0], h[0]) + 1):
		j = h[1]
		if (i, j) != h and (i, j) != a:
			print(i, j)
			s1.add((i, j))
	for j in range(min(a[1], h[1]), max(a[1], h[1]) + 1):
		i = a[0]
		if (i, j) != h and (i, j) != a and ((i, j) not in s1):
			print(i, j)
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
c = tuple(map(int, input().split()))
h = peres(peres(prm(a, b), prm(a, c)), prm(b, c))[0]
print(rst(a, h) + rst(b, h) + rst(c, h) - 2)
printt(a)
printt(b)
printt(c)
print(*h)


from itertools import permutations, chain

def get_plots(a, b):
	(ax, ay) = a
	(bx, by) = b
	for x in range(ax, bx, 1 if ax < bx else -1):
		yield (x, ay)
	for y in range(ay, by, 1 if ay < by else -1):
		yield (bx, y)

def solve(points):
	for (a, b, c) in permutations(points):
		(ax, ay) = a
		(bx, by) = b
		(cx, cy) = c
		if min(ax, bx) <= cx <= max(ax, bx) and min(ay, by) <= cy <= max(ay, by):
			return list(chain(get_plots(a, c), get_plots(c, b), [b]))

	def it():
		for (a, b, c) in permutations(points):
			(ax, ay) = a
			(bx, by) = b
			m = (ax, by)
			L = list(chain(get_plots(a, m), get_plots(b, m), get_plots(c, m), [m]))
			yield (len(L), L)
	return min(it())[1]
points = [tuple(map(int, input().split())) for _ in range(3)]
res = solve(points)
print(len(res))
for (x, y) in res:
	print(x, y)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
base1 = {(x1, y1)}
for i in range(min(x2, x1), max(x2, x1) + 1):
	base1.add((i, y1))
for i in range(min(x3, x1), max(x3, x1) + 1):
	base1.add((i, y1))
for i in range(min(y2, y1), max(y2, y1) + 1):
	base1.add((x2, i))
for i in range(min(y3, y1), max(y3, y1) + 1):
	base1.add((x3, i))
base2 = {(x2, y2)}
for i in range(min(x2, x1), max(x2, x1) + 1):
	base2.add((i, y2))
for i in range(min(x3, x2), max(x3, x2) + 1):
	base2.add((i, y2))
for i in range(min(y2, y1), max(y2, y1) + 1):
	base2.add((x1, i))
for i in range(min(y3, y2), max(y3, y2) + 1):
	base2.add((x3, i))
base3 = {(x2, y2)}
for i in range(min(x3, x1), max(x3, x1) + 1):
	base3.add((i, y3))
for i in range(min(x3, x2), max(x3, x2) + 1):
	base3.add((i, y3))
for i in range(min(y3, y1), max(y3, y1) + 1):
	base3.add((x1, i))
for i in range(min(y3, y2), max(y3, y2) + 1):
	base3.add((x2, i))
ans = {}
if len(base1) < len(base2):
	ans = base1
else:
	ans = base2
if len(ans) > len(base3):
	ans = base3
print(len(ans))
for i in ans:
	print(*i)


a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
c = tuple(map(int, input().split()))
todig = []
p = [a, b, c]
p.sort(key=lambda x: x[0])
m = p[1]
min_1 = min(a[1], b[1], c[1])
max_1 = max(a[1], b[1], c[1])
for i in range(min_1, max_1 + 1):
	todig.append((m[0], i))
for d in p:
	if d != m:
		for i in range(m[0], d[0] + 1):
			todig.append((i, d[1]))
		for i in range(d[0], m[0] + 1):
			todig.append((i, d[1]))
todig = set(todig)
print(len(todig))
for i in todig:
	print('{} {}'.format(i[0], i[1]))


(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())

def f(cx, ax, bx, cy, ay, by):
	mxy = max(ay, by, cy)
	mny = min(ay, by, cy)
	print(abs(cx - bx) + mxy - mny + 1)
	for i in range(mny, mxy + 1):
		print(ax, i)
	if cx <= bx:
		for i in range(cx, ax):
			print(i, cy)
		for i in range(ax + 1, bx + 1):
			print(i, by)
	else:
		for i in range(bx, ax):
			print(i, by)
		for i in range(ax + 1, cx + 1):
			print(i, cy)
if cx <= ax <= bx or bx <= ax <= cx:
	f(cx, ax, bx, cy, ay, by)
elif cx <= bx <= ax or ax <= bx <= cx:
	f(cx, bx, ax, cy, by, ay)
elif bx <= cx <= ax or ax <= cx <= bx:
	f(bx, cx, ax, by, cy, ay)


pts = [list(map(int, input().split())) for i in range(3)]
pts.sort()
ans = []
for i in range(pts[0][0], pts[1][0]):
	ans.append([i, pts[0][1]])
for i in range(min(pts[0][1], min(pts[1][1], pts[2][1])), max(pts[0][1], max(pts[1][1], pts[2][1])) + 1):
	ans.append([pts[1][0], i])
for i in range(pts[1][0] + 1, pts[2][0] + 1):
	ans.append([i, pts[2][1]])
print(len(ans))
for elem in ans:
	print(*elem)


import collections as cl
Cell = cl.namedtuple('Cell', ['col', 'row'])
(a, b, c) = (Cell(*map(int, input().split())) for _ in 'abc')
(bottom, top) = (min(a.row, b.row, c.row), max(a.row, b.row, c.row))
(left, right) = (min(a.col, b.col, c.col), max(a.col, b.col, c.col))
field = []
min_d = 10 ** 6
min_c = Cell(-1, -1)
for row in range(bottom, top + 1):
	field.append([])
	for col in range(left, right + 1):
		dist = sum([abs(row - cell.row) + abs(col - cell.col) for cell in (a, b, c)])
		field[-1].append(dist)
		if dist < min_d:
			min_d = dist
			min_c = Cell(col, row)
cnt = 0
ans = {min_c}
for crd in (a, b, c):
	ans.add(crd)
	while crd != min_c:
		if crd.col > left and field[crd.row - bottom][crd.col - left - 1] < field[crd.row - bottom][crd.col - left]:
			crd = Cell(crd.col - 1, crd.row)
		elif crd.col < right and field[crd.row - bottom][crd.col - left + 1] < field[crd.row - bottom][crd.col - left]:
			crd = Cell(crd.col + 1, crd.row)
		elif crd.row > bottom and field[crd.row - bottom - 1][crd.col - left] < field[crd.row - bottom][crd.col - left]:
			crd = Cell(crd.col, crd.row - 1)
		elif crd.row < top and field[crd.row - bottom + 1][crd.col - right] < field[crd.row - bottom][crd.col - right]:
			crd = Cell(crd.col, crd.row + 1)
		ans.add(crd)
ans = list(ans)
print(len(ans))
for i in range(len(ans)):
	print(*ans[i])


P = sorted([tuple(map(int, input().split())) for i in range(3)])
X = P[1][0]
S = {(x, P[0][1] if x < X else P[2][1]) for x in range(P[0][0], P[2][0] + 1)}
P.sort(key=lambda p: p[1])
S.update(((X, y) for y in range(P[0][1], P[2][1] + 1)))
print(len(S))
for _ in S:
	print(_[0], _[1])


(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
if ax > bx:
	(ax, bx) = (bx, ax)
	(ay, by) = (by, ay)
if ax > cx:
	(ax, cx) = (cx, ax)
	(ay, cy) = (cy, ay)
if bx > cx:
	(bx, cx) = (cx, bx)
	(by, cy) = (cy, by)
ans = []
for i in range(min(ay, by, cy), max(ay, by, cy) + 1):
	ans.append([bx, i])
for i in range(ax, bx):
	ans.append([i, ay])
for i in range(bx + 1, cx + 1):
	ans.append([i, cy])
print(len(ans))
for x in ans:
	print(x[0], x[1])


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
points = [(x1, y1), (x2, y2), (y3, x3)]

def gen_points(A, B):
	return [(A[0], B[1]), (B[0], A[1])]
points += gen_points([x1, y1], [x2, y2])
points += gen_points([x2, y2], [x3, y3])
points += gen_points([x1, y1], [x3, y3])
points = list(set(points))
ans = 1000000000.0
ans_l = []

def mark_points(A, B):
	A = list(A)
	B = list(B)
	d = set()
	x_s = 1 if A[0] < B[0] else -1
	y_s = 1 if A[1] < B[1] else -1
	d.add((A[0], A[1]))
	while A[0] != B[0]:
		A[0] += x_s
		d.add((A[0], A[1]))
	while A[1] != B[1]:
		A[1] += y_s
		d.add((A[0], A[1]))
	return d
for el in points:
	d = mark_points([x1, y1], el).union(mark_points([x2, y2], el))
	d = d.union(mark_points([x3, y3], el))
	if len(d) < ans:
		ans = len(d)
		ans_l = d
print(ans)
for el in ans_l:
	print(*el)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
s = [a[:], b[:], c[:]]
(a, b, c) = sorted([a, b, c])
if c[1] < b[1]:
	(c[1], b[1]) = (b[1], c[1])
if b[1] < a[1]:
	(b[1], a[1]) = (a[1], b[1])
if c[1] < b[1]:
	(b[1], c[1]) = (c[1], b[1])

def man_dist(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1]) + 1
dist = man_dist(a, b) + man_dist(b, c) - 1
s.sort()
a = set()
for i in range(s[0][0], s[1][0] + 1):
	a.add((i, s[0][1]))
if s[0][1] < s[1][1]:
	for i in range(s[0][1], s[1][1] + 1):
		a.add((s[1][0], i))
else:
	for i in range(s[1][1], s[0][1] + 1):
		a.add((s[1][0], i))
x = man_dist(s[1], s[2])
y = man_dist((s[1][0], s[0][1]), s[2])
z = man_dist((s[1][0], s[2][1]), s[2])
if s[2][1] in range(min(s[0][1], s[1][1]), max(s[0][1], s[1][1])):
	int_point = (s[1][0], s[2][1])
elif y > x and y > z:
	int_point = (s[1][0], s[1][1])
else:
	int_point = (s[1][0], s[0][1])
for i in range(int_point[0], s[2][0] + 1):
	a.add((i, int_point[1]))
if int_point[1] < s[2][1] + 1:
	for i in range(int_point[1], s[2][1] + 1):
		a.add((s[2][0], i))
else:
	for i in range(s[2][1], int_point[1] + 1):
		a.add((s[2][0], i))
print(dist)
for i in a:
	print(*i)


def el_round_4_C():
	listA = input().split(' ')
	xa = int(listA[0])
	ya = int(listA[1])
	listB = input().split(' ')
	xb = int(listB[0])
	yb = int(listB[1])
	listC = input().split(' ')
	xc = int(listC[0])
	yc = int(listC[1])
	listx = []
	listy = []
	listx.append(xa)
	listx.append(xb)
	listx.append(xc)
	listy.append(ya)
	listy.append(yb)
	listy.append(yc)
	listx.sort()
	listy.sort()
	print(listx[2] - listx[0] + listy[2] - listy[0] + 1)
	if xa == listx[0]:
		x = xa
		y = ya
	elif xb == listx[0]:
		x = xb
		y = yb
	elif xc == listx[0]:
		x = xc
		y = yc
	while x < listx[1]:
		print(str(x) + ' ' + str(y))
		x += 1
	for y in range(listy[0], listy[2] + 1):
		print(str(x) + ' ' + str(y))
	if listx[2] == xa:
		y = ya
	elif listx[2] == xb:
		y = yb
	elif listx[2] == xc:
		y = yc
	if listx[2] > listx[1]:
		for x in range(listx[1] + 1, listx[2] + 1):
			print(str(x) + ' ' + str(y))
el_round_4_C()


(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
(x3, y3) = list(map(int, input().split()))
a = [[x1, y1], [x2, y2], [x3, y3]]
a.sort()
ans = []
if a[1][1] <= a[2][1]:
	x = a[1][0]
	y = a[1][1]
	while y <= a[2][1]:
		ans += [[x, y]]
		y += 1
	y -= 1
	x += 1
	while x <= a[2][0]:
		ans += [[x, y]]
		x += 1
else:
	x = a[1][0]
	y = a[1][1]
	while y >= a[2][1]:
		ans += [[x, y]]
		y -= 1
	y += 1
	x += 1
	while x <= a[2][0]:
		ans += [[x, y]]
		x += 1
if a[1][1] <= a[0][1]:
	x = a[1][0]
	y = a[1][1]
	while y <= a[0][1]:
		if [x, y] not in ans:
			ans += [[x, y]]
		y += 1
	y -= 1
	x -= 1
	while x >= a[0][0]:
		if [x, y] not in ans:
			ans += [[x, y]]
		x -= 1
else:
	x = a[1][0]
	y = a[1][1]
	while y >= a[0][1]:
		if [x, y] not in ans:
			ans += [[x, y]]
		y -= 1
	y += 1
	x -= 1
	while x >= a[0][0]:
		if [x, y] not in ans:
			ans += [[x, y]]
		x -= 1
print(len(ans))
for i in range(len(ans)):
	print(*ans[i])


def man_dist(a1, a2, b1, b2):
	return int(abs(a1 - b1) + abs(a2, b2))

def print_md(ax, ay, bx, by):
	ret = []
	if ax > bx:
		xz = ax
		yz = ay
		ax = bx
		ay = by
		bx = xz
		by = yz
	for i in range(ax + 1, bx):
		ret.append([i, min(ay, by)])
	if ay > by:
		z = ax
	else:
		z = bx
	for j in range(min(ay, by) + 1, max(ay, by)):
		ret.append([z, j])
	if ay > by:
		ret.append([ax, by])
	else:
		ret.append([bx, ay])
	return ret
(xa, ya) = list(map(int, input().split()))
(xb, yb) = list(map(int, input().split()))
(xc, yc) = list(map(int, input().split()))
if max(xb, xc) > xa > min(xb, xc) and max(yb, yc) > ya > max(yb, yc):
	print(man_dist(xc, yc, xb, yb) - 2)
	ans = []
	for i in print_md(xb, yb, xa, ya):
		ans.append(i)
	for i in print_md(xa, ya, xc, yc):
		if ans.count(i) == 0:
			ans.append(i)
elif max(xa, xc) > xb > min(xa, xc) and max(ya, yc) > yb > max(ya, yc):
	print(man_dist(xa, ya, xc, yc) - 2)
	xz = xa
	yz = ya
	xa = xb
	ya = yb
	xb = xz
	yb = yz
	ans = []
	for i in print_md(xb, yb, xa, ya):
		ans.append(i)
	for i in print_md(xa, ya, xc, yc):
		if ans.count(i) == 0:
			ans.append(i)
elif max(xa, xb) > xc > min(xa, xb) and max(ya, yb) > yc > max(ya, yb):
	print(man_dist(xa, ya, xb, yb) - 2)
	xz = xa
	yz = ya
	xa = xc
	ya = yc
	xc = xz
	yc = yz
	ans = []
	for i in print_md(xb, yb, xa, ya):
		ans.append(i)
	for i in print_md(xa, ya, xc, yc):
		if ans.count(i) == 0:
			ans.append(i)
else:
	if yb < yc and yb < ya:
		xz = xb
		yz = yb
		xb = xc
		yb = yc
		xc = xz
		yc = yz
	elif ya < yc and ya < yb:
		xz = xa
		yz = ya
		xa = xc
		ya = yc
		xc = xz
		yc = yz
	ans = print_md(xa, ya, xb, yb)
	if xc < min(xa, xb):
		for i in print_md(xc, yc, min(xa, xb), min(ya, yb)):
			if ans.count(i) == 0:
				ans.append(i)
	elif xc > max(xa, xb):
		for i in print_md(xc, yc, max(xa, xb), min(ya, yb)):
			if ans.count(i) == 0:
				ans.append(i)
	else:
		for i in print_md(xc, yc, xc, min(ya, yb)):
			if ans.count(i) == 0:
				ans.append(i)
if ans.count([xa, ya]) == 0:
	ans.append([xa, ya])
if ans.count([xb, yb]) == 0:
	ans.append([xb, yb])
if ans.count([xc, yc]) == 0:
	ans.append([xc, yc])
print(len(ans))
for i in ans:
	print(i[0], i[1])


def movetotochka(a, b, c, d):
	x = a
	y = b
	if a > c:
		while x != c:
			print(x, y)
			x -= 1
	else:
		while x != c:
			print(x, y)
			x += 1
	if b > d:
		while y != d:
			print(x, y)
			y -= 1
	else:
		while y != d:
			print(x, y)
			y += 1
(a, b) = list(map(int, input().split()))
(c, d) = list(map(int, input().split()))
(e, f) = list(map(int, input().split()))
g = min(a, c, e)
h = max(a, c, e)
j = min(b, d, f)
k = max(b, d, f)
n1 = [a, c, e]
n2 = [b, d, f]
l = 0
m = 0
x = -1
y = -1
summa = 10000000000
for i in range(3):
	for i1 in range(3):
		l = n1[i]
		m = n2[i1]
		n = abs(l - a) + abs(l - c) + abs(l - e) + abs(m - b) + abs(m - d) + abs(m - f)
		if n < summa:
			summa = n
			x = l
			y = m
if x != -1 and y != -1:
	print(summa + 1)
	movetotochka(a, b, x, y)
	movetotochka(c, d, x, y)
	movetotochka(e, f, x, y)
	print(x, y)


def medium(a, b, c):
	return a + b + c - max(a, b, c) - min(a, b, c)

def wayy(x1, y1, x2, y2):
	(nx, ny) = (x1, y1)
	if [nx, ny] not in way:
		way.append([nx, ny])
	while nx != x2 or ny != y2:
		if x2 > nx:
			nx += 1
		elif x2 < nx:
			nx -= 1
		if y2 > ny:
			ny += 1
		elif y2 < ny:
			ny -= 1
		if [nx, ny] not in way:
			way.append([nx, ny])
(ax, ay) = map(int, input().split())
(bx, by) = map(int, input().split())
(cx, cy) = map(int, input().split())
way = []
mx = medium(ax, bx, cx)
my = medium(ay, by, cy)
wayy(ax, ay, mx, ay)
wayy(bx, by, mx, by)
wayy(cx, cy, mx, cy)
wayy(mx, ay, mx, my)
wayy(mx, by, mx, my)
wayy(mx, cy, mx, my)
print(len(way))
for elem in way:
	print(*elem)


def path(x1, y1, x2, y2, hor):
	out = []
	if hor:
		for i in range(x2 - x1):
			out.append((x1 + i, y1))
		if y2 > y1:
			for i in range(y2 - y1):
				out.append((x2, y1 + i))
		else:
			for i in range(y1 - y2):
				out.append((x2, y1 - i))
	else:
		for i in range(x2 - x1):
			out.append((x2 - i, y2))
		if y2 > y1:
			for i in range(y2 - y1):
				out.append((x1, y2 - i))
		else:
			for i in range(y1 - y2):
				out.append((x1, y2 + i))
	return out[1:]
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
(e, f) = map(int, input().split())
if a > c:
	(a, b, c, d) = (c, d, a, b)
if c > e:
	(c, d, e, f) = (e, f, c, d)
if a > c:
	(a, b, c, d) = (c, d, a, b)
if c == e and abs(f - b) < abs(d - b):
	(c, d, e, f) = (e, f, c, d)
g1 = path(a, b, c, d, True)
if d > b:
	if f < b:
		g2 = path(c, b, e, f, True)
	elif f < d:
		g2 = path(c, f, e, f, True)
	else:
		g2 = path(c, d, e, f, True)
elif f < d:
	g2 = path(c, d, e, f, True)
elif f < b:
	g2 = path(c, f, e, f, True)
else:
	g2 = path(c, b, e, f, True)
print(len(g1) + len(g2) + 3)
print(a, b)
print(c, d)
print(e, f)
for (x, y) in g1:
	print(x, y)
for (x, y) in g2:
	print(x, y)


(xa, ya) = map(int, input().split())
(xb, yb) = map(int, input().split())
(xc, yc) = map(int, input().split())
a = [(xa, ya), (xb, yb), (xc, yc)]
a.sort()
xa = a[0][0]
xb = a[1][0]
xc = a[2][0]
ya = a[0][1]
yb = a[1][1]
yc = a[2][1]
b = []
z = []
for i in range(1050):
	b.append([0] * 1050)
b[xa][ya] = 1
b[xb][yb] = 1
b[xc][yc] = 1
for i in range(xa + 1, xb + 1):
	if b[i][ya] == 0:
		z.append((i, ya))
		b[i][ya] = 1
if yb > ya:
	for i in range(ya + 1, yb):
		if b[xb][i] == 0:
			z.append((xb, i))
			b[xb][i] = 1
else:
	for i in range(yb + 1, ya):
		if b[xb][i] == 0:
			z.append((xb, i))
			b[xb][i] = 1
for i in range(xc - 1, xb - 1, -1):
	if b[i][yc] == 0:
		z.append((i, yc))
		b[i][yc] = 1
if yc < yb:
	for i in range(yc + 1, yb):
		if b[xb][i] == 0:
			z.append((xb, i))
			b[xb][i] = 1
else:
	for i in range(yb + 1, yc):
		if b[xb][i] == 0:
			z.append((xb, i))
			b[xb][i] = 1
z.append((xa, ya))
z.append((xb, yb))
z.append((xc, yc))
print(len(z))
for i in z:
	print(i[0], i[1])


def func(m, n, key):
	global x, y
	x0 = m
	y0 = n
	if key == 1:
		for j in range(abs(x - m)):
			if x > m:
				print(x0, y0)
				x0 += 1
			else:
				print(x0, y0)
				x0 -= 1
		for j in range(abs(y - n)):
			if abs(y - y0) > ymin:
				if y > n:
					print(x0, y0)
					y0 += 1
				else:
					print(x0, y0)
					y0 -= 1
	else:
		for j in range(abs(y - n)):
			if y > n:
				print(x0, y0)
				y0 += 1
			else:
				print(x0, y0)
				y0 -= 1
		for j in range(abs(x - m)):
			if abs(x - x0) > xmin:
				if x > m:
					print(x0, y0)
					x0 += 1
				else:
					print(x0, y0)
					x0 -= 1
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
x = sorted([x1, x2, x3])[1]
y = sorted([y1, y2, y3])[1]
xmin = min(abs(x - x1), abs(x - x2), abs(x - x3))
ymin = min(abs(y - y1), abs(y - y2), abs(y - y3))
print(abs(x - x1) + abs(x - x2) + abs(x - x3) + abs(y - y1) + abs(y - y2) + abs(y - y3) + 1 - max(xmin, ymin))
if xmin < ymin:
	key = 1
	for i in range(ymin):
		print(x, y + i + 1)
		print(x, y - i - 1)
else:
	key = -1
	for i in range(xmin):
		print(x + xmin + 1, y)
		print(x - xmin - 1, y)
func(x1, y1, key)
func(x2, y2, key)
func(x3, y3, key)
print(x, y)


class Coord:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def cdist(c1, c2):
	return abs(c1.x - c2.x) + abs(c1.y - c2.y)

def dist(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
(x1, y1) = list(map(int, input().split()))
(x2, y2) = list(map(int, input().split()))
(x3, y3) = list(map(int, input().split()))
cs = [Coord(x1, y1), Coord(x2, y2), Coord(x3, y3)]
s = set()
s.add(tuple([x1, y1]))
s.add(tuple([x2, y2]))
s.add(tuple([x3, y3]))
shifts = [[0, 1], [1, 0], [0, -1], [-1, 0]]
for i in range(3):
	cur = cs[i]
	other = []
	for j in range(3):
		if j != i:
			other.append(cs[j])
	cur_x = cur.x
	cur_y = cur.y
	while True:
		cnt = 0
		for sh in shifts:
			(new_x, new_y) = (cur_x + sh[0], cur_y + sh[1])
			flag = 0
			for oth in other:
				(oth_x, oth_y) = (oth.x, oth.y)
				if dist(cur_x, cur_y, oth_x, oth_y) > dist(new_x, new_y, oth_x, oth_y):
					pass
				else:
					flag += 1
			if flag:
				cnt += 1
				continue
			s.add(tuple([new_x, new_y]))
			(cur_x, cur_y) = (new_x, new_y)
			break
		if cnt == 4:
			break
arr = list(s)
print(len(arr))
for a in arr:
	print(*a)


(xa, ya) = list(map(int, input().split()))
(xb, yb) = list(map(int, input().split()))
(xc, yc) = list(map(int, input().split()))
if xa > xb:
	(xa, xb, ya, yb) = (xb, xa, yb, ya)
if xb > xc:
	(xb, xc, yb, yc) = (xc, xb, yc, yb)
if xa > xb:
	(xa, xb, ya, yb) = (xb, xa, yb, ya)
y_min = min(ya, yb, yc)
y_max = max(ya, yb, yc)
print(-xa + xc + y_max - y_min + 1)
for i in range(xa, xb):
	print(i, ya)
for i in range(xc, xb, -1):
	print(i, yc)
for i in range(y_min, y_max + 1):
	print(xb, i)


(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
(x3, y3) = map(int, input().split())
k = max(y1, y2, y3) + 1 - min(y1, y2, y3) + max(x1, x2, x3) - min(x1, x2, x3)
m = [0, y1, y2, y3]
m.sort()
z = [0, x1, x2, x3]
z.sort()
print(k)
for i in range(z[1], z[3] + 1):
	print(str(i) + ' ' + str(m[2]))
for i in range(m[2] + 1, m[3] + 1):
	if m[3] == y3:
		print(str(x3) + ' ' + str(i))
	if m[3] == y2:
		print(str(x2) + ' ' + str(i))
	if m[3] == y1:
		print(str(x1) + ' ' + str(i))
for i in range(m[1], m[2]):
	if m[1] == y3:
		print(str(x3) + ' ' + str(i))
	if m[1] == y2:
		print(str(x2) + ' ' + str(i))
	if m[1] == y1:
		print(str(x1) + ' ' + str(i))


a = [[int(i) for i in input().split()] for k in range(3)]
a.sort()
c = a[2]
b = a[1]
a = a[0]
print(c[0] - a[0] + max(a[1], b[1], c[1]) - min(a[1], b[1], c[1]) + 1)
xturn = b[0]
for i in range(a[0], b[0]):
	print('{} {}'.format(i, a[1]))
for i in range(min(a[1], b[1], c[1]), max(a[1], b[1], c[1]) + 1):
	print('{} {}'.format(b[0], i))
for i in range(b[0] + 1, c[0] + 1):
	print('{} {}'.format(i, c[1]))