The Squareland national forest is divided into equal $1 \times 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 \leq x_A, y_A \leq 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 \leq x_B, y_B, x_C, y_C \leq 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: interview

Starter code:

Solutions:
ax, ay = list(map(int, input().split()))
bx, by = list(map(int, input().split()))
cx, cy = list(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)


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])
#print(pos)
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])
    



xa, ya = list(map(int, input().split()))
xb, yb =  list(map(int, input().split()))
xc, yc= list(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))
     





# list(map(int, input().split()))
# map(int, input().split())

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)


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()


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)

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)

xa, ya = list(map(int, input().split()))
xb, yb = list(map(int, input().split()))
xc, yc = list(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])


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])

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]):  # X increment
    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): # Y increment
    result.append((mean_x, i))

print(len(result))
for item in result:
    print(item[0], item[1])

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([" ".join((str(x[0]), str(x[1]))) for x in list(path)])
print(len(path))
print("\n".join(path))


def func(m, n, key):
    nonlocal 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 = list(map(int, input().split()))
x2, y2 = list(map(int, input().split()))
x3, y3 = list(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)


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()))
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 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):
    nonlocal 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)

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):
    nonlocal 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)

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)

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)


x1,y1=list(map(int,input().split()))
x2,y2=list(map(int,input().split()))
x3,y3=list(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))
    
        
        
        
                
        


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()))
"""
WAY_X = max(x_A, x_B, x_C) - min(x_A, x_B, x_C) + 1
WAY_y = max(y_A, y_B, y_C) - min(y_A, y_B, y_C) + 1
if x_A == x_B == x_C or y_A == y_B == y_C:
    cross = 0
elif x_A == x_B or x_A == x_C or x_B == x_C:
    cross = 1
elif y_A == x_B or y_A == y_C or y_B == y_C:
    cross = 1
else:
    cross = 2
print(WAY_X, WAY_y, cross)
"""
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())

# base 1
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))

# base 2
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))

# base 3
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)

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])

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)
   else:
      if 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])