#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << " -- " << #x << ": " << (x) << "\n"
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const long long INF = 2000000000LL;
const long double EPS = 1e-9;

vector< pii > clear(vector<pii> v) {
	vector<pii> ret;
	int tox = v[1].ff;
	int x = v[0].ff, y = v[0].ss;
	while(x <= tox) {
		ret.pb({x, y});
		++x;
	}
	int tx = v[1].ff, ty = v[1].ss;
	while(ty != y) {
		ret.pb({tx, ty});
		(ty > y) ? --ty : ++ty;
	}
	// till 2 done

	tox = v[2].ff;
	int toy = v[2].ss;
	int p = v[0].ss, q = v[1].ss;
	if(p > q) swap(p, q);
	if(v[2].ss >= p and v[2].ss <= q) {
		while(x <= tox) {
			ret.pb({x, toy});
			++x;
		}
	}
	else if(v[2].ss < p) {
		while(x <= tox) {
			ret.pb({x, p});
			++x;
		}
		while(toy != p) {
			ret.pb({tox, toy});
			(toy > p) ? --toy : ++toy;
		}
	}
	else {
		// cout << "here\n";
		while(x <= tox) {
			ret.pb({x, q});
			// cout << "pushed " << ret.back().ff << " " << ret.back().ss << "\n";
			++x;
		}
		while(toy != q) {
			ret.pb({tox, toy});
			// cout << "pushed " << ret.back().ff << " " << ret.back().ss << " -2\n";
			(toy > q) ? --toy : ++toy;
		}
	}
	return ret;
}

int main() {
	FastIO;

	vector<pii> v(3);
	for(int i=0; i<3; ++i) cin >> v[i].ff >> v[i].ss;
	sort(all(v));

	auto res = clear(v);
	sort(all(res));
	res.erase(unique(all(res)), res.end());

	cout << res.size() << "\n";
	for(auto x : res) cout << x.ff << " "  << x.ss << "\n";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << " -- " << #x << ": " << (x) << "\n"
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const long long INF = 2000000000LL;
const long double EPS = 1e-9;

vector< pii > clear(vector<pii> v) {
	vector<pii> ret;
	bool same = ((v[1].ss-v[0].ss > 0) == (v[2].ss-v[0].ss > 0));
	if(!same) {
		int tox = v[2].ff;
		int x = v[0].ff, y = v[0].ss;
		while(x <= tox) {
			ret.pb({x, y});
			++x;
		}
		for(int i=1; i<3; ++i) {
			int tx = v[i].ff, ty = v[i].ss;
			while(ty != y) {
				ret.pb({tx, ty});
				(ty > y) ? --ty : ++ty;
			}
		}
	}
	else {
		int tox = v[1].ff;
		int x = v[0].ff, y = v[0].ss;
		while(x <= tox) {
			ret.pb({x, y});
			++x;
		}
		int tx = v[1].ff, ty = v[1].ss;
		while(ty != y) {
			ret.pb({tx, ty});
			(ty > y) ? --ty : ++ty;
		}
		// till 2 done

		int d2 = abs(v[2].ff-v[1].ff) + abs(v[2].ss-v[1].ss);
		int d0 = abs(v[2].ff-x) + abs(v[2].ss-y);
		if(d0 < d2) {
			tox = v[2].ff;
			while(x <= tox) {
				ret.pb({x, y});
				++x;
			}
			tx = v[2].ff, ty = v[2].ss;
			while(ty != y) {
				ret.pb({tx, ty});
				(ty > y) ? --ty : ++ty;
			}
		}
		else {
			tox = v[2].ff;
			x = v[1].ff, y = v[1].ss;
			while(x <= tox) {
				ret.pb({x, y});
				++x;
			}
			tx = v[2].ff, ty = v[2].ss;
			while(ty != y) {
				ret.pb({tx, ty});
				(ty > y) ? --ty : ++ty;
			}
		}
	}
	return ret;
}

int main() {
	FastIO;

	vector<pii> v(3);
	for(int i=0; i<3; ++i) cin >> v[i].ff >> v[i].ss;
	sort(all(v));
	for(auto x : v) cout << x.ff << " " << x.ss << "\n";

	auto res = clear(v);
	sort(all(res));
	res.erase(unique(all(res)), res.end());

	cout << res.size() << "\n";
	for(auto x : res) cout << x.ff << " "  << x.ss << "\n";

	return 0;
}


#include<bits/stdc++.h>
#define pii pair<int,int>
using namespace std;

pii ans[1000005];
int cnt;
pii a[5];
bool cmp(pii x,pii y){
	if(x.first!=y.first)return x.first<y.first;
	return x.second<y.second;
}

void add(pii x,pii y){
	for(int i=x.first;i<=y.first;i++)ans[++cnt]=pii(i,x.second);
//	if(x.second>y.second)swap(x.second,y.second);
	if(x.second<=y.second)
		for(int i=x.second+1;i<=y.second;i++)ans[++cnt]=pii(y.first,i);
	else
		for(int i=y.second;i<=x.second-1;i++)ans[++cnt]=pii(y.first,i);
}

int main(){
//	scanf("%d%d%d%d",&a[1].first,&a[1].second,&a[2].first,&a[2].second);
//	add(a[1],a[2]);
//	for(int i=1;i<=cnt;i++)cout<<ans[i].first<<" "<<ans[i].second<<endl;

	for(int i=1;i<=3;i++)scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+4,cmp);
	if(a[2].second>=a[1].second){
		if(a[3].second>=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			if(a[3].second>=a[1].second){
				add(a[1],a[2]);
				for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
			}
			else{
				add(a[1],a[3]);
				for(int i=a[1].second+1;i<=a[2].second;i++)ans[++cnt]=pii(a[2].first,i);
			}
		}
	}
	else{
		if(a[3].second<=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			if(a[3].second<=a[1].second){
				add(a[1],a[2]);
				for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
			}
			else{
				add(a[1],a[3]);
				for(int i=a[1].second-1;i>=a[2].second;i--)ans[++cnt]=pii(a[2].first,i);
			}
		}
	}
	printf("%d\n",cnt);
	for(int i=1;i<=cnt;i++)printf("%d %d\n",ans[i].first,ans[i].second);
}


#include<bits/stdc++.h>
#define pii pair<int,int>
using namespace std;

pii ans[1000005];
int cnt;
pii a[5];
bool cmp(pii x,pii y){
	if(x.first!=y.first)return x.first<y.first;
	return x.second<y.second;
}

void add(pii x,pii y){
	for(int i=x.first;i<=y.first;i++)ans[++cnt]=pii(i,x.second);
	if(x.second>y.second)swap(x.second,y.second);
	for(int i=x.second+1;i<=y.second;i++)ans[++cnt]=pii(y.first,i);
}

int main(){
//	scanf("%d%d%d%d",&a[1].first,&a[1].second,&a[2].first,&a[2].second);
//	add(a[1],a[2]);
//	for(int i=1;i<=cnt;i++)cout<<ans[i].first<<" "<<ans[i].second<<endl;

	for(int i=1;i<=3;i++)scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+4,cmp);
	if(a[2].second>=a[1].second){
		if(a[3].second>=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			add(a[1],a[2]);
			for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
		}
	}
	else{
		if(a[3].second<=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			add(a[1],a[2]);
			for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
		}
	}
	printf("%d\n",cnt);
	for(int i=1;i<=cnt;i++)printf("%d %d\n",ans[i].first,ans[i].second);
}


#include<bits/stdc++.h>
#define pii pair<int,int>
using namespace std;

pii ans[1000005];
int cnt;
pii a[5];
bool cmp(pii x,pii y){
	if(x.first!=y.first)return x.first<y.first;
	return x.second<y.second;
}

void add(pii x,pii y){
	for(int i=x.first;i<=y.first;i++)ans[++cnt]=pii(i,x.second);
//	if(x.second>y.second)swap(x.second,y.second);
	if(x.second<=y.second)
		for(int i=x.second+1;i<=y.second;i++)ans[++cnt]=pii(y.first,i);
	else
		for(int i=x.second-1;i>=y.second;i--)ans[++cnt]=pii(y.first,i);
}

int main(){
//	scanf("%d%d%d%d",&a[1].first,&a[1].second,&a[2].first,&a[2].second);
//	add(a[1],a[2]);
//	for(int i=1;i<=cnt;i++)cout<<ans[i].first<<" "<<ans[i].second<<endl;

	for(int i=1;i<=3;i++)scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+4,cmp);
	if(a[2].second>=a[1].second){
		if(a[3].second>=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			if(a[3].second>=a[1].second){
				add(a[1],a[2]);
				for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
			}
			else{
				add(a[1],a[3]);
				for(int i=a[1].second+1;i<=a[2].second;i++)ans[++cnt]=pii(a[2].first,i);
			}
		}
	}
	else{
		if(a[3].second<=a[2].second){
			add(a[1],a[2]);
			cnt--;
			add(a[2],a[3]);
		}
		else{
			if(a[3].second<=a[1].second){
				add(a[1],a[2]);
				for(int i=a[2].first+1;i<=a[3].first;i++)ans[++cnt]=pii(i,a[3].second);
			}
			else{
				add(a[1],a[3]);
				for(int i=a[1].second-1;i>=a[2].second;i--)ans[++cnt]=pii(a[2].first,i);
			}
		}
	}
	printf("%d\n",cnt);
	for(int i=1;i<=cnt;i++)printf("%d %d\n",ans[i].first,ans[i].second);
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int mat[N][N];
pair<int, int> p[N][N];

int dx[] = {0, 0, 1,-1};
int dy[] = {1,-1, 0, 0};

vector<pair<int, int>> solve(int xa, int ya, int xb, int yb,int xc,int yc){

    memset(mat, 0, sizeof mat);
    memset(p, -1, sizeof p);
    p[xa][ya] = {xa, ya};

    queue<pair<int, int>> q;
    q.emplace(xa, ya);

    int a, b;
    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(a == xb && b == yb) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }
    while(!q.empty()) q.pop();

    vector<pair<int, int>> ans;
    {
        a = xb, b = yb;
        while(a != xa || b != ya){
            ans.emplace_back(a, b);
            mat[a][b] = 1;
            tie(a, b) = p[a][b];
        }
        mat[xa][ya] = 1;
        ans.emplace_back(xa, ya);
    }

    memset(p, -1, sizeof p);

    q.emplace(xc, yc);

    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(mat[a][b]) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }

    {
        tie(a, b) = p[a][b];
        while(a != xc || b != yc){
            ans.emplace_back(a, b);
            tie(a, b) = p[a][b];
        }
        ans.emplace_back(xc, yc);
    }

    return ans;
}

int main(){

    int xa, ya, xb, yb, xc, yc;
    scanf("%d %d", &xa, &ya);
    scanf("%d %d", &xb, &yb);
    scanf("%d %d", &xc, &yc);

    auto ans = solve(xa, ya, xb, yb, xc, yc);

    //auto tmp = solve(xc, yc, xb, yb, xa, ya);
    //if(tmp.size() < ans.size()) swap(ans, tmp);

    printf("%d\n", (int)ans.size());

    for(auto w : ans)
        printf("%d %d\n", w.first, w.second);

}


#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int mat[N][N];
pair<int, int> p[N][N];

int dx[] = {0, 0, 1,-1};
int dy[] = {1,-1, 0, 0};

vector<pair<int, int>> straight(int a, int b, int c, int d){
    vector<pair<int, int>> ans;
    while(a != c){
        if(a < c) a++;
        else a--;
        ans.emplace_back(a, b);
    }
    while(b != d){
        if(b < d) b++;
        else b--;
        ans.emplace_back(a, b);
    }
    return ans;
}

vector<pair<int, int>> solve(int xa, int ya, int xb, int yb,int xc,int yc){

    memset(p, -1, sizeof p);

    queue<pair<int, int>> q;

    int a, b;

    q.emplace(xc, yc);
    p[xc][yc] = {xc, yc};

    vector<pair<int, int>> ans;
    int dist = abs(xa-xb) + abs(ya-yb);
    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(abs(a-xa)+abs(b-ya)+abs(a-xb)+abs(b-yb) <= dist){
            for(auto w : straight(a, b, xa, ya))
                ans.push_back(w);
            for(auto w : straight(a, b, xb, yb))
                ans.push_back(w);
            break;
        }

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }

    while(!q.empty()) q.pop();

    {
        while(a != xc || b != yc){
            ans.emplace_back(a, b);
            tie(a, b) = p[a][b];
        }
        ans.emplace_back(xc, yc);
    }

    return ans;
}

int main(){

    int xa, ya, xb, yb, xc, yc;
    scanf("%d %d", &xa, &ya);
    scanf("%d %d", &xb, &yb);
    scanf("%d %d", &xc, &yc);

    auto ans = solve(xa, ya, xb, yb, xc, yc);

    auto tmp = solve(xc, yc, xb, yb, xa, ya);
    if(tmp.size() < ans.size()) swap(ans, tmp);
    tmp.clear();

    tmp = solve(xc, yc, xa, ya, xb, yb);
    if(tmp.size() < ans.size()) swap(ans, tmp);
    tmp.clear();

    printf("%d\n", (int)ans.size());

    for(auto w : ans)
        printf("%d %d\n", w.first, w.second);

}


#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int mat[N][N];
pair<int, int> p[N][N];

int dx[] = {0, 0, 1,-1};
int dy[] = {1,-1, 0, 0};

vector<pair<int, int>> solve(int xa, int ya, int xb, int yb,int xc,int yc){

    memset(mat, 0, sizeof mat);
    memset(p, -1, sizeof p);
    p[xa][ya] = {xa, ya};

    queue<pair<int, int>> q;
    q.emplace(xa, ya);

    int a, b;
    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(a == xb && b == yb) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }
    while(!q.empty()) q.pop();

    vector<pair<int, int>> ans;
    {
        a = xb, b = yb;
        while(a != xa || b != ya){
            ans.emplace_back(a, b);
            mat[a][b] = 1;
            tie(a, b) = p[a][b];
        }
        mat[xa][ya] = 1;
        ans.emplace_back(xa, ya);
    }

    memset(p, -1, sizeof p);

    q.emplace(xc, yc);
    p[xc][yc] = {xc, yc};

    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(mat[a][b]) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }

    while(!q.empty()) q.pop();

    assert(mat[a][b]);

    {
        tie(a, b) = p[a][b];
        while(a != xc || b != yc){
            ans.emplace_back(a, b);
            tie(a, b) = p[a][b];
        }
        ans.emplace_back(xc, yc);
    }

    return ans;
}

int main(){

    int xa, ya, xb, yb, xc, yc;
    scanf("%d %d", &xa, &ya);
    scanf("%d %d", &xb, &yb);
    scanf("%d %d", &xc, &yc);

    auto ans = solve(xa, ya, xb, yb, xc, yc);

    auto tmp = solve(xc, yc, xb, yb, xa, ya);
    if(tmp.size() < ans.size()) swap(ans, tmp);
    tmp.clear();

    tmp = solve(xc, yc, xa, ya, xb, yb);
    if(tmp.size() < ans.size()) swap(ans, tmp);
    tmp.clear();

    printf("%d\n", (int)ans.size());

    for(auto w : ans)
        printf("%d %d\n", w.first, w.second);

}


#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int mat[N][N];
pair<int, int> p[N][N];

int dx[] = {0, 0, 1,-1};
int dy[] = {1,-1, 0, 0};

vector<pair<int, int>> solve(int xa, int ya, int xb, int yb,int xc,int yc){

    memset(mat, 0, sizeof mat);
    memset(p, -1, sizeof p);
    p[xa][ya] = {xa, ya};

    queue<pair<int, int>> q;
    q.emplace(xa, ya);

    int a, b;
    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(a == xb && b == yb) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }
    while(!q.empty()) q.pop();

    vector<pair<int, int>> ans;
    {
        a = xb, b = yb;
        while(a != xa || b != ya){
            ans.emplace_back(a, b);
            mat[a][b] = 1;
            tie(a, b) = p[a][b];
        }
        mat[xa][ya] = 1;
        ans.emplace_back(xa, ya);
    }

    memset(p, -1, sizeof p);

    q.emplace(xc, yc);

    while(!q.empty()){
        tie(a, b) = q.front();
        q.pop();
        if(mat[a][b]) break;

        for(int i = 0; i < 4; i++){
            int xx = a + dx[i], yy = b + dy[i];
            if(xx < 0 || xx > 1002) continue;
            if(yy < 0 || yy > 1002) continue;
            if(p[xx][yy].first != -1) continue;
            p[xx][yy] = {a, b};
            q.emplace(xx, yy);
        }
    }

    {
        tie(a, b) = p[a][b];
        while(a != xc || b != yc){
            ans.emplace_back(a, b);
            tie(a, b) = p[a][b];
        }
        ans.emplace_back(xc, yc);
    }

    return ans;
}

int main(){

    int xa, ya, xb, yb, xc, yc;
    scanf("%d %d", &xa, &ya);
    scanf("%d %d", &xb, &yb);
    scanf("%d %d", &xc, &yc);

    auto ans = solve(xa, ya, xb, yb, xc, yc);

    auto tmp = solve(xc, yc, xb, yb, xa, ya);
    if(tmp.size() < ans.size()) swap(ans, tmp);

    tmp = solve(xc, yc, xa, ya, xb, yb);
    if(tmp.size() < ans.size()) swap(ans, tmp);

    printf("%d\n", (int)ans.size());

    for(auto w : ans)
        printf("%d %d\n", w.first, w.second);

}


/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define R(i,a,b) for (int i=(a);i<(b);i++)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define x first
#define y second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define N 500055
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,ans,tot;
pa z[10],c[N];
void get(pa a,pa b){
	F(i,a.x,b.x){
		c[++tot]=mp(i,a.y);
	}
	if (a.y<b.y)
	F(i,a.y+1,b.y){
		c[++tot]=mp(b.x,i);
	}
	else R(i,b.y,a.y) c[++tot]=mp(b.x,i);
}
void g(pa a,pa b){
	F(i,a.x+1,b.x){
		c[++tot]=mp(i,a.y);
	}
	if (a.y<b.y)
	F(i,a.y+1,b.y){
		c[++tot]=mp(b.x,i);
	}
	else R(i,b.y,a.y) c[++tot]=mp(b.x,i);
}
int g_dis(pa a,pa b){
	return abs(a.x-b.x)+abs(a.y-b.y);
}
signed main(){
	n=3;
	F(i,1,3) z[i].x=read(),z[i].y=read();
	sort(z+1,z+n+1);
	get(z[1],z[2]);
	int mi=0;
	F(i,1,tot){
		if (g_dis(c[i],z[3])<g_dis(c[mi],z[3])||mi==0) mi=i;
	}
	g(c[mi],z[3]);
	wrn(tot);
	F(i,1,tot) wrn(c[i].x,c[i].y);
	return 0;
}
/*
0 3
2 1
2 5
*/


/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define R(i,a,b) for (int i=(a);i<(b);i++)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define x first
#define y second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define N 500055
#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,ans,tot;
pa z[10],c[N];
void get(pa a,pa b){
	F(i,a.x,b.x){
		c[++tot]=mp(i,a.y);
	}
	if (a.y>b.y) swap(a.y,b.y);
	F(i,a.y+1,b.y){
		c[++tot]=mp(b.x,i);
	}
}
void g(pa a,pa b){
	F(i,a.x+1,b.x){
		c[++tot]=mp(i,a.y);
	}
	if (a.y>b.y) swap(a.y,b.y);
	F(i,a.y+1,b.y){
		c[++tot]=mp(b.x,i);
	}
}
int g_dis(pa a,pa b){
	return abs(a.x-b.x)+abs(a.y-b.y);
}
signed main(){
	n=3;
	F(i,1,3) z[i].x=read(),z[i].y=read();
	sort(z+1,z+n+1);
	get(z[1],z[2]);
	int mi=0;
	F(i,1,tot){
		if (g_dis(c[i],z[3])<g_dis(c[mi],z[3])||mi==0) mi=i;
	}
	g(c[mi],z[3]);
	wrn(tot);
	F(i,1,tot) wrn(c[i].x,c[i].y);
	return 0;
}


#ifndef OUUAN
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
#endif
#include<bits/stdc++.h>
#define int long long
#define For(i,l,r) for (i=l;i<=r;++i)
#define FOR(i,r,l) for (i=r;i>=l;--i)
#define SON(i,u) for (i=head[u];i;i=nxt[i])
#define ms(a,x) memset(a,x,sizeof(a))
#define X first
#define fi first
#define Y second
#define se second
#define pq priority_queue
#define vi vector<int>
#define br putchar('\n')
#define sp putchar(' ')
#define pb push_back
#define isinf(x) (x>=INF?-1:x)

using namespace std;

#ifdef int
const int INF=0x3f3f3f3f3f3f3f3fll;
#endif
#ifndef int
const int INF=0x3f3f3f3f;
#endif
const double eps=1e-8;

typedef pair<int,int> pii;

inline int read()
{
    char c;int out=0,f=1;
    for (c=getchar();!isdigit(c)&&c!='-';c=getchar());if (c=='-'){f=-1;c=getchar();}
    for (;isdigit(c);c=getchar()){out=(out<<3)+(out<<1)+c-'0';}return out*f;
}
inline void read(int& x)
{
    char c;int f=1;x=0;
    for (c=getchar();!isdigit(c)&&c!='-';c=getchar());if (c=='-'){f=-1;c=getchar();}
    for (;isdigit(c);c=getchar()){x=(x<<3)+(x<<1)+c-'0';}x*=f;
}
void write(int x)
{
	if (x<0){putchar('-');write(-x);return;}
    if (x>9){write(x/10);}putchar(x%10+'0');
}
void wts(int x){write(x);sp;}
void wtb(int x){write(x);br;}
template<typename... Args>void read(int& x,Args&... args){read(x);read(args...);}
template<typename... Args>void wts(int x,Args... args){wts(x);wts(args...);}
template<typename... Args>void wtb(int x,Args... args){wtb(x);wtb(args...);}

template<class T> inline bool up(T &x,const T &y){return x<y?x=y,1:0;}
template<class T> inline bool dn(T &x,const T &y){return x>y?x=y,1:0;}

template<typename T>auto Max(T x)->decltype(x){return x;}
template<typename T,typename... Args>auto Max(T x,Args... args)->decltype(x){return max(x,Max(args...));}
template<typename T>auto Min(T x)->decltype(x){return x;}
template<typename T,typename... Args>auto Min(T x,Args... args)->decltype(x){return min(x,Min(args...));}

const int N=100010;
const int M=1000000007;

pii a[3];

signed main()
{
	int i,maxx,minn;

	for (i=0;i<3;++i)
	{
		read(a[i].fi,a[i].se);
	}

	sort(a,a+3);

	maxx=Max(a[0].se,a[1].se,a[2].se);
	minn=Min(a[0].se,a[1].se,a[2].se);

	cout<<a[2].fi-a[0].fi+1+maxx-minn;

	for (i=a[0].fi;i<a[1].fi;++i)
	{
		cout<<endl<<i<<' '<<a[0].se;
	}

	for (i=minn;i<=maxx;++i)
	{
		cout<<endl<<a[1].fi<<' '<<i;
	}

	for (i=a[1].fi+1;i<=a[2].fi;++i)
	{
		cout<<endl<<i<<' '<<a[2].se;
	}

	return 0;
}


#ifndef OUUAN
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
#endif
#include<bits/stdc++.h>
#define int long long
#define For(i,l,r) for (i=l;i<=r;++i)
#define FOR(i,r,l) for (i=r;i>=l;--i)
#define SON(i,u) for (i=head[u];i;i=nxt[i])
#define ms(a,x) memset(a,x,sizeof(a))
#define X first
#define fi first
#define Y second
#define se second
#define pq priority_queue
#define vi vector<int>
#define br putchar('\n')
#define sp putchar(' ')
#define pb push_back
#define isinf(x) (x>=INF?-1:x)

using namespace std;

#ifdef int
const int INF=0x3f3f3f3f3f3f3f3fll;
#endif
#ifndef int
const int INF=0x3f3f3f3f;
#endif
const double eps=1e-8;

typedef pair<int,int> pii;

inline int read()
{
    char c;int out=0,f=1;
    for (c=getchar();!isdigit(c)&&c!='-';c=getchar());if (c=='-'){f=-1;c=getchar();}
    for (;isdigit(c);c=getchar()){out=(out<<3)+(out<<1)+c-'0';}return out*f;
}
inline void read(int& x)
{
    char c;int f=1;x=0;
    for (c=getchar();!isdigit(c)&&c!='-';c=getchar());if (c=='-'){f=-1;c=getchar();}
    for (;isdigit(c);c=getchar()){x=(x<<3)+(x<<1)+c-'0';}x*=f;
}
void write(int x)
{
	if (x<0){putchar('-');write(-x);return;}
    if (x>9){write(x/10);}putchar(x%10+'0');
}
void wts(int x){write(x);sp;}
void wtb(int x){write(x);br;}
template<typename... Args>void read(int& x,Args&... args){read(x);read(args...);}
template<typename... Args>void wts(int x,Args... args){wts(x);wts(args...);}
template<typename... Args>void wtb(int x,Args... args){wtb(x);wtb(args...);}

template<class T> inline bool up(T &x,const T &y){return x<y?x=y,1:0;}
template<class T> inline bool dn(T &x,const T &y){return x>y?x=y,1:0;}

template<typename T>auto Max(T x)->decltype(x){return x;}
template<typename T,typename... Args>auto Max(T x,Args... args)->decltype(x){return max(x,Max(args...));}
template<typename T>auto Min(T x)->decltype(x){return x;}
template<typename T,typename... Args>auto Min(T x,Args... args)->decltype(x){return min(x,Min(args...));}

const int N=100010;
const int M=1000000007;

pii a[3];

signed main()
{
	int i,maxx,minn;

	for (i=0;i<3;++i)
	{
		read(a[i].fi,a[i].se);
	}

	sort(a,a+3);

	maxx=Max(a[0].se,a[1].se,a[2].se);
	minn=Min(a[0].se,a[1].se,a[2].se);

	cout<<a[2].fi-a[0].fi+1+maxx-minn;

	for (i=a[0].fi;i<a[1].fi;++i)
	{
		printf("\n%I64d %I64d",i,a[0].se);
	}

	for (i=minn;i<=maxx;++i)
	{
		printf("\n%I64d %I64d",a[1].fi,i);
	}

	for (i=a[1].fi+1;i<=a[2].fi;++i)
	{
		printf("\n%d %d",i,a[2].se);
	}

	return 0;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int x[3],y[3];
inline void solve(int stx,int sty,int edx,int edy)
{
	for(int i=stx+1;i<=edx;i++)pr1(i),pr2(sty);
	for(int i=edx;i<stx;i++)pr1(i),pr2(sty);
	for(int i=sty+1;i<=edy;i++)pr1(edx),pr2(i);
	for(int i=edy;i<sty;i++)pr1(edx),pr2(i);
}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    for(int i=0;i<3;i++)x[i]=read(),y[i]=read();
    int ans=-1,px,py;
    for(int i=0;i<=1000;i++)
    {
    	for(int j=0;j<=1000;j++)
    	{
    		int sum=1;
    		for(int k=0;k<3;k++)sum+=abs(i-x[k])+abs(j-y[k]);
    		if(ans==-1 || ans>sum)ans=sum,px=i,py=j;
    	}
    }
    pr2(ans);
    pr1(px),pr2(py);
    for(int i=0;i<3;i++)solve(px,py,x[i],y[i]);
    return 0;
}


#include <bits/stdc++.h>

#define fst first
#define sec second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;

namespace NoBrains {
    inline bool cmp(pair<int, int> x, pair<int, int> y) {
        if (x.fst == y.fst) return x.sec < y.sec;
        return x.fst < y.fst;
    }

    void __main__() {
        pair<int, int> p[3];
        for (int i = 0; i < 3; ++i) {
            int x, y; cin >> x >> y;
            p[i] = mp(x, y);
        }
        sort(p, p + 3, cmp);
        // for (int i = 0; i < 3; ++i) cout << p[i].fst << " " << p[i].sec << endl;
        if (p[0].fst == p[1].fst) {
            // int x = p[1].fst, y = p[2].sec;
            int num = 0;
            num += p[2].fst - p[1].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[1].fst + 1; i <= p[2].fst; ++i) {
                printf("%d %d\n", i, p[2].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        } else if (p[2].fst == p[1].fst) {
            // int x = p[1].fst, y = p[0].sec;
            int num = 0;
            num += p[1].fst - p[0].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[0].fst; i < p[1].fst; ++i) {
                printf("%d %d\n", i, p[0].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        } else {
            // int x1 = p[1].fst, y1 = p[0].sec;
            // int x2 = p[1].fst, y2 = p[0].sec;
            int num = 0;
            num += p[2].fst - p[0].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[0].fst; i < p[1].fst; ++i) {
                printf("%d %d\n", i, p[0].sec);
            }
            for (int i = p[1].fst + 1; i <= p[2].fst; ++i) {
                printf("%d %d\n", i, p[2].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        }
    }
}

int main() {
    NoBrains::__main__();
    return 0;
}


#include <bits/stdc++.h>

#define fst first
#define sec second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;

namespace NoBrains {
    inline bool cmp(pair<int, int> x, pair<int, int> y) {
        if (x.fst == y.fst) return x.sec < y.sec;
        return x.fst < y.fst;
    }

    void __main__() {
        pair<int, int> p[3];
        for (int i = 0; i < 3; ++i) {
            int x, y; cin >> x >> y;
            p[i] = mp(x, y);
        }
        sort(p, p + 3, cmp);
        // for (int i = 0; i < 3; ++i) cout << p[i].fst << " " << p[i].sec << endl;
        if (p[0].fst == p[1].fst) {
            // int x = p[1].fst, y = p[2].sec;
            int num = 0;
            num += p[2].fst - p[1].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[1].fst + 1; i <= p[2].fst; ++i) {
                printf("%d %d\n", i, p[2].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        } else if (p[2].fst == p[1].fst) {
            // int x = p[1].fst, y = p[0].sec;
            int num = 0;
            num += p[1].fst - p[0].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[0].fst; i < p[1].fst; ++i) {
                printf("%d %d\n", i, p[0].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        } else {
            // int x1 = p[1].fst, y1 = p[0].sec;
            // int x2 = p[1].fst, y2 = p[0].sec;
            int num = 0;
            num += p[2].fst - p[0].fst;
            int top = max(p[2].sec, max(p[0].sec, p[1].sec));
            int low = min(p[2].sec, min(p[0].sec, p[1].sec));
            num += top - low + 1;
            cout << num << endl;
            for (int i = p[0].fst; i <= p[2].fst; ++i) {
                if (i != p[1].fst) printf("%d %d\n", i, p[0].sec);
            }
            for (int i = low; i <= top; ++i) {
                printf("%d %d\n", p[1].fst, i);
            }
        }
    }
}

int main() {
    NoBrains::__main__();
    return 0;
}


#include <bits/stdc++.h>
#define eps 1e-8
#define PI acos(-1)
#define INF 1000000000
#define ll long long
#define ld long double
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

ll x[4],y[4],res,ru,rv;

ll kc(ll a,ll b,ll u,ll v)
{
	return(abs(u-a)+abs(v-b));
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	FOR(i,1,3)
	cin>>x[i]>>y[i];

	res=10000;

	FOR(u,0,1000)
	FOR(v,0,1000){
		ll temp = 0;
		FOR(i,1,3) temp=temp+kc(x[i],y[i],u,v);
		if (res>temp) {
			res=temp;
			ru=u;
			rv=v;
		}
	}

	cout<<res<<endl;
	cout<<ru<<' '<<rv<<endl;

	FOR(i,1,3){
		ll tu=ru;
		ll tv=rv;
		while (tu<x[i]){
			tu++;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tu>x[i]){
			tu--;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tv<y[i]){
			tv++;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tv>y[i]){
			tv--;
			cout<<tu<<' '<<tv<<endl;
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define eps 1e-8
#define PI acos(-1)
#define INF 1000000000
#define ll long long
#define ld long double
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

ll x[4],y[4],res,ru,rv;

ll kc(ll a,ll b,ll u,ll v)
{
	return(abs(u-a)+abs(v-b));
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	FOR(i,1,3)
	cin>>x[i]>>y[i];

	res=10000;

	FOR(u,0,1000)
	FOR(v,0,1000){
		ll temp = 1;
		FOR(i,1,3) temp=temp+kc(x[i],y[i],u,v);
		if (res>temp) {
			res=temp;
			ru=u;
			rv=v;
		}
	}

	cout<<res<<endl;
	cout<<ru<<' '<<rv<<endl;

	FOR(i,1,3){
		ll tu=ru;
		ll tv=rv;
		while (tu<x[i]){
			tu++;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tu>x[i]){
			tu--;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tv<y[i]){
			tv++;
			cout<<tu<<' '<<tv<<endl;
		}
		while (tv>y[i]){
			tv--;
			cout<<tu<<' '<<tv<<endl;
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int x[5],y[5];
vector <pair<int,int> > ans;
signed main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x[i],&y[i]);
	for (int i=1;i<=3;i++) ans.push_back(m_k(x[i],y[i]));
	sort(x+1,x+4);sort(y+1,y+4);
	int tx=x[2],ty=y[2];
	while (tx!=x[1])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[1]) tx--;
		else tx++;
	}
	while (ty!=y[1])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[1]) ty--;
		else ty++;
	}
	tx=x[2],ty=y[2];
	while (tx!=x[2])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[2]) tx--;
		else tx++;
	}
	while (ty!=y[2])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[2]) ty--;
		else ty++;
	}
	tx=x[2],ty=y[2];
	while (tx!=x[3])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[3]) tx--;
		else tx++;
	}
	while (ty!=y[3])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[3]) ty--;
		else ty++;
	}
	sort(ans.begin(),ans.end());
	int w=unique(ans.begin(),ans.end())-ans.begin();
	printf("%d\n",w);
	for (int i=0;i<w;i++) printf("%d %d\n",ans[i].first,ans[i].second);
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int x[5],y[5];
vector <pair<int,int> > ans;
signed main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x[i],&y[i]);
	sort(x+1,x+4);sort(y+1,y+4);
	int tx=x[2],ty=y[2];
	while (tx!=x[1])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[1]) tx--;
		else tx++;
	}
	while (ty!=y[1])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[1]) ty--;
		else ty++;
	}
	tx=x[2],ty=y[2];
	while (tx!=x[2])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[2]) tx--;
		else tx++;
	}
	while (ty!=y[2])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[2]) ty--;
		else ty++;
	}
	tx=x[2],ty=y[2];
	while (tx!=x[3])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[3]) tx--;
		else tx++;
	}
	while (ty!=y[3])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[3]) ty--;
		else ty++;
	}
	for (int i=1;i<=3;i++) ans.push_back(m_k(x[i],y[i]));
	sort(ans.begin(),ans.end());
	int w=unique(ans.begin(),ans.end())-ans.begin();
	printf("%d\n",w);
	for (int i=0;i<w;i++) printf("%d %d\n",ans[i].first,ans[i].second);
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int x[5],y[5],a[5],b[5];
vector <pair<int,int> > ans;
signed main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x[i],&y[i]),a[i]=x[i],b[i]=y[i];
	for (int i=1;i<=3;i++) ans.push_back(m_k(x[i],y[i]));
	sort(a+1,a+4);sort(b+1,b+4);
	int tx=a[2],ty=b[2];
	while (tx!=x[1])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[1]) tx--;
		else tx++;
	}
	while (ty!=y[1])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[1]) ty--;
		else ty++;
	}
	tx=a[2],ty=b[2];
	while (tx!=x[2])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[2]) tx--;
		else tx++;
	}
	while (ty!=y[2])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[2]) ty--;
		else ty++;
	}
	tx=a[2],ty=b[2];
	while (tx!=x[3])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[3]) tx--;
		else tx++;
	}
	while (ty!=y[3])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[3]) ty--;
		else ty++;
	}
	sort(ans.begin(),ans.end());
	int w=unique(ans.begin(),ans.end())-ans.begin();
	printf("%d\n",w);
	for (int i=0;i<w;i++) printf("%d %d\n",ans[i].first,ans[i].second);
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int x[5],y[5];
vector <pair<int,int> > ans;
signed main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x[i],&y[i]);
	sort(x+1,x+4);sort(y+1,y+4);
	int tx=x[1],ty=y[1];
	while (tx!=x[1])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[1]) tx--;
		else tx++;
	}
	while (ty!=y[1])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[1]) ty--;
		else ty++;
	}
	tx=x[1],ty=y[1];
	while (tx!=x[2])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[2]) tx--;
		else tx++;
	}
	while (ty!=y[2])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[2]) ty--;
		else ty++;
	}
	tx=x[1],ty=y[1];
	while (tx!=x[3])
	{
		ans.push_back(m_k(tx,ty));
		if (tx>x[3]) tx--;
		else tx++;
	}
	while (ty!=y[3])
	{
		ans.push_back(m_k(tx,ty));
		if (ty>y[3]) ty--;
		else ty++;
	}
	sort(ans.begin(),ans.end());
	int w=unique(ans.begin(),ans.end())-ans.begin();
	printf("%d\n",w+1);
	for (int i=0;i<=w;i++) printf("%d %d\n",ans[i].first,ans[i].second);
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
using namespace std;
int x[5],y[5];
int get(int i,int j)
{
	return abs(x[i]-x[j])+abs(y[i]-y[j])-1;
}
void print(int i,int j)
{
	if (y[i]>y[j]) swap(i,j);
	for (int k=y[i]+1;k<=y[j];k++) printf("%d %d\n",x[i],k);
	if (x[j]<x[i])
	{
		for (int k=x[j]+1;k<x[i];k++) printf("%d %d\n",k,y[j]);
	}
	else
	{
		for (int k=x[i]+1;k<x[j];k++) printf("%d %d\n",k,y[j]);
	}
}
signed main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x[i],&y[i]);
	if (x[1]==x[2] && x[2]==x[3])
	{
		int l=min(y[1],min(y[2],y[3])),r=max(y[1],max(y[2],y[3]));
		printf("%d\n",r-l+1);
		for (int i=l;i<=r;i++) printf("%d %d\n",x[1],i);
		return 0;
	}
	if (y[1]==y[2] && y[2]==y[3])
	{
		int l=min(x[1],min(x[2],x[3])),r=max(x[1],max(x[2],x[3]));
		printf("%d\n",r-l+1);
		for (int i=l;i<=r;i++) printf("%d %d\n",i,y[1]);
		return 0;
	}
	bool bl=1;
	int MIN=inf;
	for (int i=1;i<=3;i++)
	{
		for (int j=1;j<=3;j++)
		{
			if (i==j) continue;
			if (x[i]!=x[j] && y[i]!=y[j]) continue;
			int k;
			for (k=1;k<=3;k++) if (i!=k && j!=k) break;
			if (x[i]==x[j])
			{
				int l=min(y[i],y[j]),r=max(y[i],y[j]);
				if (y[k]>r) MIN=min(MIN,r-l+1+abs(x[k]-x[i])+y[k]-r);
				else if (y[k]<l) MIN=min(MIN,r-l+1+abs(x[k]-x[i])+l-y[k]);
				else MIN=min(MIN,r-l+1+abs(x[k]-x[i]));
				bl=0;
			}
			if (y[i]==y[j])
			{
				int l=min(x[i],x[j]),r=max(x[i],x[j]);
				if (x[k]>r) MIN=min(MIN,r-l+1+abs(y[k]-y[i])+x[k]-r);
				else if (x[k]<l) MIN=min(MIN,r-l+1+abs(y[k]-y[i])+l-x[k]);
				else MIN=min(MIN,r-l+1+abs(y[k]-y[i]));
				bl=0;
			}
		}
	}
	if (!bl)
	{
		printf("%d\n",MIN);
		for (int i=1;i<=3;i++)
		{
			for (int j=1;j<=3;j++)
			{
				if (i==j) continue;
				if (x[i]!=x[j] && y[i]!=y[j]) continue;
				int k,ans;
				for (k=1;k<=3;k++) if (i!=k && j!=k) break;
				if (x[i]==x[j])
				{
					int l=min(y[i],y[j]),r=max(y[i],y[j]);
					if (y[k]>r) ans=r-l+1+abs(x[k]-x[i])+y[k]-r;
					else if (y[k]<l) ans=r-l+1+abs(x[k]-x[i])+l-y[k];
					else ans=r-l+1+abs(x[k]-x[i]);
					if (ans==MIN)
					{
						for (int i=min(l,y[k]);i<=max(r,y[k]);i++) printf("%d %d\n",x[i],i);
						l=min(x[k],x[i]),r=max(x[k],x[i]);
						for (int i=l;i<=r;i++) if (i!=x[i]) printf("%d %d\n",i,y[k]);
						return 0;
					}
				}
				if (y[i]==y[j])
				{
					int l=min(x[i],x[j]),r=max(x[i],x[j]);
					if (x[k]>r) ans=r-l+1+abs(y[k]-y[i])+x[k]-r;
					else if (x[k]<l) ans=r-l+1+abs(y[k]-y[i])+l-x[k];
					else ans=r-l+1+abs(y[k]-y[i]);
					if (ans==MIN)
					{
						for (int i=min(l,x[k]);i<=max(r,x[k]);i++) printf("%d %d\n",i,y[i]);
						l=min(y[k],y[i]),r=max(y[k],y[i]);
						for (int i=l;i<=r;i++) if (i!=y[i]) printf("%d %d\n",x[k],i);
						return 0;
					}
				}
			}
		}
	}
	for (int i=1;i<=3;i++)
	{
		for (int j=1;j<=3;j++)
		{
			if (i==j) continue;
			for (int k=1;k<=3;k++)
			{
				if (k==i || k==j) continue;
				MIN=min(MIN,get(i,j)+get(j,k)+3);
			}
		}
	}
	for (int i=1;i<=3;i++)
	{
		for (int j=1;j<=3;j++)
		{
			if (i==j) continue;
			for (int k=1;k<=3;k++)
			{
				if (k==i || k==j) continue;
				if (MIN==get(i,j)+get(j,k)+3)
				{
					printf("%d\n",MIN);
					print(i,j);print(j,k);
					printf("%d %d\n%d %d\n%d %d\n",x[i],y[i],x[j],y[j],x[k],y[k]);
					return 0;
				}
			}
		}
	}
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

struct Point{
  int x,y;
}ps[3];

struct XCmp{
  bool operator()(struct Point a,struct Point b)const{
    return a.x<b.x;
  }
};
struct YCmp{
  bool operator()(struct Point a,struct Point b)const{
    return a.y<b.y;
  }
};

int main(){
  for(int i=0;i<3;i++){
    scanf("%d %d",&ps[i].x,&ps[i].y);
  }
  std::sort(ps,ps+3,XCmp());
  std::vector<struct Point> vs;
  while(ps[0].x<ps[1].x){
    vs.push_back(ps[0]);
    ps[0].x++;
  }
  while(ps[2].x>ps[1].x){
    vs.push_back(ps[2]);
    ps[2].x--;
  }
  std::sort(ps,ps+3,YCmp());
  while(ps[0].y<ps[1].y){
    vs.push_back(ps[0]);
    ps[0].y++;
  }
  while(ps[2].y>ps[1].y){
    vs.push_back(ps[2]);
    ps[2].y--;
  }
  vs.push_back(ps[0]);
  printf("%d\n",(int)vs.size());
  for(struct Point p:vs){
    printf("%d %d\n",p.x,p.y);
  }
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

#define f first
#define s second

vector<pair<int, int> > cod(3), result;
int map[1005][1005];

int main(){

    ios::sync_with_stdio(false);
    cin>>cod[0].f>>cod[0].s>>cod[1].f>>cod[1].s>>cod[2].f>>cod[2].s;

    sort(cod.begin(), cod.end());
    // for(int i=0;i<cod.size();i++){
    //     cout<<cod[i].f<<" "<<cod[i].s<<endl;
    // }
    int x = cod[0].f, y = cod[0].s;
    while(x != cod[1].f){
        map[y][x] = 1;
        x += 1;
    }
    map[y][x] = 1;

    int dy = y < cod[1].s? 1: -1;
    while(y != cod[1].s){
        map[y][x] = 1;
        y += dy;
    }
    map[y][x] = 1;

    dy = y < cod[2].s? 1: -1;
    while(y != cod[2].s){
        map[y][x] = 1;
        y += dy;
    }
    map[y][x] = 1;

    while(x != cod[2].f){
        map[y][x] = 1;
        x += 1;
    }
    map[y][x] = 1;

    int tol = 0;

    for(int i=0; i<1005; i++){
        for(int j=0; j<1005; j++){
            if(map[i][j] == 1){
                tol++;
                result.push_back(make_pair(j, i));
            }
        }
    }

    cout<<tol<<"\n";
    for(int i=0; i<result.size(); i++){
        cout<<result[i].f<<" "<<result[i].s<<"\n";
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int x[3];
int y[3];

int dist(int i, int j) {
        int resp = 1;

        for (int k = 0; k < 3; k++) {
                resp += abs(i - x[k]) + abs(j - y[k]);
        }
        return resp;
}

int main () {

        for (int i = 0; i < 3; i++) {
                scanf("%d %d", &x[i], &y[i]);
        }

        int mini = 1000000;
        int m_x =  -1, m_y = -1;
        for (int i = 0; i <= 1000; i++) {
                for (int j = 0; j <= 1000; j++) {
                      if (dist(i, j) < mini) {
                        mini = dist(i, j);
                        m_x = i;
                        m_y = j;
                      }
                }
        }

        printf("%d\n", mini);
        printf("%d %d\n", m_x, m_y);
        for (int k = 0; k < 3; k++) {

                int a = x[k];
                int b = y[k];

                while (a != m_x || b != m_y) {
                        printf("%d %d\n", a, b);
                        if (a != m_x) {
                                if (a < m_x)
                                        a++;
                                else
                                        a--;
                        } else {
                                if (b < m_y)
                                        b++;
                                else
                                        b--;
                        }
                }
        }

        return 0;

}


#include <bits/stdc++.h>
using namespace std;

int x[3],y[3];

set <pair <int, int>> ans;

int main(){
	for (int i=0;i<3;i++)
		cin>>x[i]>>y[i];
	int sx=x[0]+x[1]+x[2]
		-max(x[0],max(x[1],x[2]))
		-min(x[0],min(x[1],x[2]));
	int sy=y[0]+y[1]+y[2]
		-max(y[0],max(y[1],y[2]))
		-min(y[0],min(y[1],y[2]));
	ans.insert(make_pair(sx,sy));
	for (int i=0;i<3;i++){
		int tx=x[i],ty=y[i];
		while (tx>sx){
			ans.insert(make_pair(tx,ty));
			tx--;
		}
		while (tx<sx){
			ans.insert(make_pair(tx,ty));
			tx++;
		}
		while (ty>sy){
			ans.insert(make_pair(tx,ty));
			ty--;
		}
		while (ty<sy){
			ans.insert(make_pair(tx,ty));
			ty++;
		}
	}
	cout<<ans.size()<<endl;
	for (auto &s: ans)
		cout<<s.first<<' '<<s.second<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int xa,xb,xc,ya,yb,yc,ans;
inline int dis(int a1,int b1,int a2,int b2){return abs(a1-a2)+abs(b1-b2);}
inline void track(int x,int y,int tx,int ty){
	while(x<tx)printf("%d %d\n",x++,y);
	while(x>tx)printf("%d %d\n",x--,y);
	while(y<ty)printf("%d %d\n",x,y++);
	while(y>ty)printf("%d %d\n",x,y--);
	printf("%d %d\n",tx,ty);
}
int main(){
	ios::sync_with_stdio(false);
	scanf("%d%d%d%d%d%d",&xa,&ya,&xb,&yb,&xc,&yc);
	if(xa>xb)swap(xa,xb),swap(ya,yb);
	if(xa>xc)swap(xa,xc),swap(ya,yc);
	if(xb>xc)swap(xb,xc),swap(yb,yc);
	ans=dis(xa,ya,xb,yb)+1;
	int ttmp1=min(yb,ya),ttmp2=max(yb,ya);
	if(ttmp1<=yc&&yc<=ttmp2){
		ans+=dis(xb,0,xc,0);
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		if(xc!=xb)track(xb+1,yc,xc,yc);
		return 0;
	}
	int tmp2=dis(xb,yb,xc,yc),tmp3=dis(xb,ya,xc,yc);
	if(tmp2<tmp3){
		ans+=tmp2;
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		track(xb,yb+(yb<yc?1:-1),xc,yc);
	}else{
		ans+=tmp3;
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		track(xb,ya+(ya<yc?1:-1),xc,yc);
	}return 0;
}


#include<bits/stdc++.h>
using namespace std;
int xa,xb,xc,ya,yb,yc,ans;
inline int dis(int a1,int b1,int a2,int b2){return abs(a1-a2)+abs(b1-b2);}
inline void track(int x,int y,int tx,int ty){
	while(x!=tx)cout<<(x++)<<' '<<y<<"\n";
	while(y!=ty)cout<<x<<' '<<(y++)<<"\n";
	cout<<tx<<' '<<ty<<"\n";
}
int main(){
	ios::sync_with_stdio(false);
	cin>>xa>>ya>>xb>>yb>>xc>>yc;
	if(xa>xb)swap(xa,xb),swap(ya,yb);
	if(xa>xc)swap(xa,xc),swap(ya,yc);
	if(xb>xc)swap(xb,xc),swap(yb,yc);
	ans=dis(xa,ya,xb,yb)+1;
	int ttmp1=min(yb,ya),ttmp2=max(yb,ya);
	if(ttmp1<=yc&&yc<=ttmp2){
		ans+=dis(xb,0,xc,0);
		cout<<ans<<endl;
		track(xa,ya,xb,yb);
		if(xc!=xb)track(xb+1,yc,xc,yc);
		return 0;
	}
	int tmp2=dis(xb,yb,xc,yc),tmp3=dis(xb,ya,xc,yc);
	if(tmp2<tmp3){
		ans+=tmp2;
		cout<<ans<<"\n";
		track(xa,ya,xb,yb);
		track(xb,yb+(yb<yc?1:-1),xc,yc);
	}else{
		ans+=tmp3;
		cout<<ans<<"\n";
		track(xa,ya,xb,yb);
		track(xb,ya+(ya<yc?1:-1),xc,yc);
	}return 0;
}


#include<bits/stdc++.h>
using namespace std;
int xa,xb,xc,ya,yb,yc,ans;
inline int dis(int a1,int b1,int a2,int b2){return abs(a1-a2)+abs(b1-b2);}
inline void track(int x,int y,int tx,int ty){
	while(x!=tx)printf("%d %d\n",x++,y);
	while(y!=ty)printf("%d %d\n",x,y++);
	printf("%d %d\n",tx,ty);
}
int main(){
	ios::sync_with_stdio(false);
	scanf("%d%d%d%d%d%d",&xa,&ya,&xb,&yb,&xc,&yc);
	if(xa>xb)swap(xa,xb),swap(ya,yb);
	if(xa>xc)swap(xa,xc),swap(ya,yc);
	if(xb>xc)swap(xb,xc),swap(yb,yc);
	ans=dis(xa,ya,xb,yb)+1;
	int ttmp1=min(yb,ya),ttmp2=max(yb,ya);
	if(ttmp1<=yc&&yc<=ttmp2){
		ans+=dis(xb,0,xc,0);
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		if(xc!=xb)track(xb+1,yc,xc,yc);
		return 0;
	}
	int tmp2=dis(xb,yb,xc,yc),tmp3=dis(xb,ya,xc,yc);
	if(tmp2<tmp3){
		ans+=tmp2;
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		track(xb,yb+(yb<yc?1:-1),xc,yc);
	}else{
		ans+=tmp3;
		printf("%d\n",ans);
		track(xa,ya,xb,yb);
		track(xb,ya+(ya<yc?1:-1),xc,yc);
	}return 0;
}


#include <bits/stdc++.h>
using namespace std;

void doRoutine() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("C:\\Users\\M\\alg\\practice\\clion_main\\input.txt", "r", stdin);
    freopen("C:\\Users\\M\\alg\\practice\\clion_main\\output.txt", "w", stdout);
#endif
}

#define DBG(VAR) cerr << #VAR << ": " << VAR << endl

#define all(x) x.begin(), x.end()
#define vb vector<bool>
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vc vector
#define $ make_pair

#ifndef LOCAL
#define cerr if(0) cerr
#define DBG(...) (true)
#endif

#define D double
#define int long long

// ----------------------------- CODE NOW ------------------------

int sign(int x) {
    return (x == 0 ? 0 : (x > 0 ? 1 : -1));
}

void add(pii from, pii to, set<pii> &st) {
    int dx = sign(to.fi - from.fi);
    int dy = sign(to.se - from.se);
    if (dx != 0) {
        while (from.fi != to.fi) {
            st.insert(from);
            from.fi += dx;
        }
    }
    if (dy != 0) {
        while (from.se != to.se) {
            st.insert(from);
            from.se += dy;
        }
    }
    st.insert(to);
}

signed main() {
    doRoutine();

    int n = 3;
    vc<pii> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].fi >> arr[i].se;
    }

    pii best;
    int dist = 1000000000;
    for (int x = 0; x <= 1000; ++x) {
        for (int y = 0; y <= 1000; ++y) {
            int sum = 0;
            for (int i = 0; i < n; ++i) {
                sum += abs(arr[i].fi - x);
                sum += abs(arr[i].se - y);
            }
            if (sum < dist) {
                best = {x, y};
                dist = sum;
            }
        }
    }

    set<pii> ans;
    for (int i = 0; i < n; ++i) {
        add(arr[i], best, ans);
    }

    cout << ans.size() << endl;
    for (auto el : ans) {
        cout << el.fi << " " << el.se << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

void doRoutine() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("C:\\Users\\M\\alg\\practice\\clion_main\\input.txt", "r", stdin);
    freopen("C:\\Users\\M\\alg\\practice\\clion_main\\output.txt", "w", stdout);
#endif
}

#define DBG(VAR) cerr << #VAR << ": " << VAR << endl

#define all(x) x.begin(), x.end()
#define vb vector<bool>
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define vc vector
#define $ make_pair

#ifndef LOCAL
#define cerr if(0) cerr
#define DBG(...) (true)
#endif

#define D double
#define int long long

// ----------------------------- CODE NOW ------------------------

void add(pii from, pii to, set<pii> &st) {
    int dx = to.fi - from.fi;
    int dy = to.se - from.se;
    if (dx != 0) {
        while (from.fi != to.fi) {
            st.insert(from);
            from.fi += dx;
        }
    }
    if (dy != 0) {
        while (from.se != to.se) {
            st.insert(from);
            from.se += dy;
        }
    }
    st.insert(to);
}

signed main() {
    doRoutine();

    int n = 3;
    vc<pii> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].fi >> arr[i].se;
    }

    pii best;
    int dist = 1000000000;
    for (int x = 0; x <= 1000; ++x) {
        for (int y = 0; y <= 1000; ++y) {
            int sum = 0;
            for (int i = 0; i < n; ++i) {
                sum += abs(arr[i].fi - x);
                sum += abs(arr[i].se - y);
            }
            if (sum < dist) {
                best = {x, y};
                dist = sum;
            }
        }
    }

    set<pii> ans;
    for (int i = 0; i < n; ++i) {
        add(arr[i], best, ans);
    }

    cout << ans.size() << endl;
    for (auto el : ans) {
        cout << el.fi << " " << el.se << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int MAXN=100005;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-v.begin())

int x[3],y[3];
pi p;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	FOR(i,0,2)cin>>x[i]>>y[i];
	int ans=INT_MAX;
	FOR(i,0,1000){
		FOR(j,0,1000){
			int cur=0;
			FOR(k,0,2)cur+=abs(x[k]-i)+abs(y[k]-j);
			if (cur<ans){
				ans=cur;
				p=pi(i,j);
			}
		}
	}
	ans++;
	cout<<ans<<"\n";
	FOR(k,0,2){
		if (p.fst<=x[k]){
			FOR(i,p.fst,x[k])if(pi(i,y[k])!=p)cout<<i<<' '<<y[k]<<"\n";
		}
		else{
			FOR(i,x[k],p.fst)if(pi(i,y[k])!=p)cout<<i<<' '<<y[k]<<"\n";
		}
		if (p.fst!=x[k]){
			if (p.snd<=y[k]){
				FOR(j,p.snd,y[k]-1)if(pi(p.fst,j)!=p)cout<<p.fst<<' '<<j<<"\n";
			}
			else{
				FOR(j,y[k]+1,p.snd)if(pi(p.fst,j)!=p)cout<<p.fst<<' '<<j<<"\n";
			}
		}
	}
	cout<<p.fst<<' '<<p.snd<<"\n";
}
/*
0 0
1 1
2 2

0 0
2 0
1 1
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int MAXN=100005;
const int MOD=1000000007;
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-v.begin())

int x[3],y[3];
pi p;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	FOR(i,0,2)cin>>x[i]>>y[i];
	int ans=INT_MAX;
	FOR(i,0,1000){
		FOR(j,0,1000){
			int cur=0;
			FOR(k,0,2)cur+=abs(x[k]-i)+abs(y[k]-j);
			if (cur<ans){
				ans=cur;
				p=pi(i,j);
			}
		}
	}
	int cnt=0;
	ans++;
	cout<<ans<<"\n";
	FOR(k,0,2){
		if (p.fst<=x[k]){
			FOR(i,p.fst,x[k])if(pi(i,y[k])!=p){
				cout<<i<<' '<<y[k]<<"\n";
				cnt++;
			}
		}
		else{
			FOR(i,x[k],p.fst)if(pi(i,y[k])!=p){
				cout<<i<<' '<<y[k]<<"\n";
				cnt++;
			}
		}
		if (p.snd<=y[k]){
			FOR(j,p.snd,y[k]-1)if(pi(p.fst,j)!=p){
				cout<<p.fst<<' '<<j<<"\n";
				cnt++;
			}
		}
		else{
			FOR(j,y[k]+1,p.snd)if(pi(p.fst,j)!=p){
				cout<<p.fst<<' '<<j<<"\n";
				cnt++;
			}
		}
	}
	cout<<p.fst<<' '<<p.snd<<"\n";
	assert(cnt==ans-1);
}
/*
0 0
1 1
2 2

0 0
2 0
1 1
*/


#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
struct P{int x,y;}a[10];
inline bool cmp(P x,P y){return x.x==y.x?x.y<y.y:x.x<y.x;}
int main()
{	int mn=1e9,mx=0;
	for(rint i=1;i<=3;i++) cin>>a[i].x>>a[i].y,mx=max(mx,a[i].y),mn=min(mn,a[i].y);
	sort(a+1,a+3+1,cmp); vector<pii> v;
	for(rint i=a[1].x;i<=a[2].x;i++) v.push_back(mp(i,a[1].y));
	for(rint i=a[2].x;i<=a[3].x;i++) v.push_back(mp(i,a[3].y));
	for(rint i=mn;i<=mx;i++) v.push_back(mp(a[2].x,i));
	sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
	cout<<v.size()<<endl;
	for(rint i=0;i<v.size();i++) printf("%d %d\n",v[i].first,v[i].second);
	return 0;
}


#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
struct P{int x,y;}a[10];
inline bool cmp(P x,P y){return x.x==y.x?x.y<y.y:x.x<y.x;}
int main()
{	int mn=1e9,mx=0;
	for(rint i=1;i<=3;i++) cin>>a[i].x>>a[i].y,mx=max(mx,a[i].y),mn=min(mn,a[i].y);
	sort(a+1,a+3+1,cmp); vector<pii> v;
	for(rint i=a[1].x;i<=a[2].x;i++) v.push_back(mp(i,a[1].y));
	for(rint i=a[2].x;i<=a[3].x;i++) v.push_back(mp(i,a[3].y));
	for(rint i=mn+1;i<mx;i++) v.push_back(mp(a[2].x,i));
	cout<<v.size()<<endl;
	for(rint i=0;i<v.size();i++) printf("%d %d\n",v[i].first,v[i].second);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int xa,ya,xb,yb,xc,yc,ansx,ansy;
void pan(int x1,int y1,int x2,int y2)
{
	int x=min(x1,x2),y=min(y1,y2);
	for (int i=x;i<=x1+x2-x;i++)
        if (!(i==x1)) cout << i << ' ' << y1 << endl;
    for (int i=y;i<=y1+y2-y;i++)
    	if (!((x2==x1&&i==y1)||(i==y1)))
    	cout << x2 << ' ' << i << endl;
}
int main()
{
	scanf("%d%d",&xa,&ya);
	scanf("%d%d",&xb,&yb);
	scanf("%d%d",&xc,&yc);
	int ans=100000000;
	for (int i=0;i<=1000;i++)
	for (int j=0;j<=1000;j++)
		if (ans>abs(xa-i)+abs(xb-i)+abs(xc-i)+abs(ya-j)+abs(yb-j)+abs(yc-j)+1)
		{
			ans=abs(xa-i)+abs(xb-i)+abs(xc-i)+abs(ya-j)+abs(yb-j)+abs(yc-j)+1;
			ansx=i; ansy=j;
		}
	cout << ans << endl;
	pan(ansx,ansy,xa,ya);
	pan(ansx,ansy,xb,yb);
	pan(ansx,ansy,xc,yc);
	cout << ansx << ' ' << ansy << endl;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <queue>

using namespace std;

template <typename T> void chkmax(T &x, T y) {x = x > y ? x : y;}
template <typename T> void chkmin(T &x, T y) {x = x > y ? y : x;}
template <typename T> void upd(T &x, T y, T mod) {x = x + y > mod ? x + y - mod : x + y;}
template <typename T> void sub(T &x, T y, T mod) {x = x - y < 0 ? x - y + mod : x - y;}
template <typename T> void multi(T &x, T y, T mod) {x = 1ll * x * y % mod;}

typedef long long ll;

const int INF = (1ll << 30);

#define DEBUG(x) std::cerr << #x << " = " << x << std::endl

template <typename T> void read (T &x) {
    x = 0; bool f = 1; char ch;
    do {ch = getchar(); if (ch == '-') f = 0;} while (ch > '9' || ch < '0');
    do {x = x * 10 + ch - '0'; ch = getchar();} while (ch >= '0' && ch <= '9');
    x = f ? x : -x;
}

template <typename T> void write (T x) {
    if (x < 0) x = ~x + 1, putchar ('-');
    if (x > 9) write (x / 10);
    putchar (x % 10 + '0');
}

struct Node {
	int x, y;
	bool operator < (const Node &rhs) const {
		return x < rhs.x || (x == rhs.x && y < rhs.y);
	}
} a[4];

vector < Node > sol;

inline void work() {
	int nowx = a[0].x, nowy = a[0].y;
	sol.push_back((Node){nowx, nowy});
	while(nowx < a[1].x) sol.push_back((Node){++nowx, nowy});
	while(nowy < a[1].y) sol.push_back((Node){nowx, ++nowy});
	while(nowy > a[1].y) sol.push_back((Node){nowx, --nowy});
	if(min(a[0].y, a[1].y) <= a[2].y && a[2].y <= max(a[0].y, a[1].y)) nowx = a[1].x, nowy = a[2].y;
	if(a[2].y < min(a[1].y, a[0].y)) nowx = a[1].x, nowy = min(a[0].y, a[1].y);
	if(a[2].y > max(a[1].y, a[0].y)) nowx = a[1].x, nowy = max(a[0].y, a[1].y);
	while(nowx < a[2].x) sol.push_back((Node){++nowx, nowy});
	while(nowy < a[2].y) sol.push_back((Node){nowx, ++nowy});
	while(nowy > a[2].y) sol.push_back((Node){nowx, --nowy});
}

int main() {
	for(int i = 0; i < 3; i++) read(a[i].x), read(a[i].y);
	sort(a, a + 3);
	work();
	printf("%d\n", (int)sol.size());
	for(int i = 0; i < sol.size(); i++) printf("%d %d\n", sol[i].x, sol[i].y);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <queue>

using namespace std;

template <typename T> void chkmax(T &x, T y) {x = x > y ? x : y;}
template <typename T> void chkmin(T &x, T y) {x = x > y ? y : x;}
template <typename T> void upd(T &x, T y, T mod) {x = x + y > mod ? x + y - mod : x + y;}
template <typename T> void sub(T &x, T y, T mod) {x = x - y < 0 ? x - y + mod : x - y;}
template <typename T> void multi(T &x, T y, T mod) {x = 1ll * x * y % mod;}

typedef long long ll;

const int INF = (1ll << 30);

#define DEBUG(x) std::cerr << #x << " = " << x << std::endl

template <typename T> void read (T &x) {
    x = 0; bool f = 1; char ch;
    do {ch = getchar(); if (ch == '-') f = 0;} while (ch > '9' || ch < '0');
    do {x = x * 10 + ch - '0'; ch = getchar();} while (ch >= '0' && ch <= '9');
    x = f ? x : -x;
}

template <typename T> void write (T x) {
    if (x < 0) x = ~x + 1, putchar ('-');
    if (x > 9) write (x / 10);
    putchar (x % 10 + '0');
}

struct Node {
	int x, y;
	bool operator < (const Node &rhs) const {
		return x < rhs.x || (x == rhs.x && y < rhs.y);
	}
} a[4];

vector < Node > sol;

inline void work() {
	int nowx = a[0].x, nowy = a[0].y;
	sol.push_back((Node){nowx, nowy});
	while(nowx < a[1].x) sol.push_back((Node){++nowx, nowy});
	while(nowy < a[1].y) sol.push_back((Node){nowx, ++nowy});
	while(nowy > a[1].y) sol.push_back((Node){nowx, --nowy});
	if(min(a[0].y, a[1].y) <= a[2].y && a[2].y <= max(a[0].y, a[1].y)) nowx = a[1].x, nowy = a[2].y;
	if(a[2].y < min(a[1].y, a[2].y)) nowx = a[1].x, nowy = min(a[0].y, a[1].y);
	if(a[2].y > max(a[1].y, a[2].y)) nowx = a[1].x, nowy = max(a[0].y, a[1].y);
	while(nowx < a[2].x) sol.push_back((Node){++nowx, nowy});
	while(nowy < a[2].y) sol.push_back((Node){nowx, ++nowy});
	while(nowy > a[2].y) sol.push_back((Node){nowx, --nowy});
}

int main() {
	for(int i = 0; i < 3; i++) read(a[i].x), read(a[i].y);
	sort(a, a + 3);
	work();
	printf("%d\n", (int)sol.size());
	for(int i = 0; i < sol.size(); i++) printf("%d %d\n", sol[i].x, sol[i].y);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int xa,ya,xb,yb,xc,yc;
int main(){
	scanf("%d%d%d%d%d%d",&xa,&ya,&xb,&yb,&xc,&yc);
	if(xa>xb || xa==xb && ya>yb) swap(xa,xb),swap(ya,yb);
	if(xa>xc || xa==xc && ya>yc) swap(xa,xc),swap(ya,yc);
	if(xb>xc || xb==xc && yb>yc) swap(xb,xc),swap(yb,yc);
	if(yb>=min(ya,yc) && yb<=max(ya,yc)){
		int ymax=max(max(ya,yb),yc),ymin=min(min(ya,yb),yc);
		printf("%d\n",xc-xa+ymax-ymin+1);
		if(ya<=yc){
			for(int i=xa;i<xb;i++)
				printf("%d %d\n",i,ya);
			for(int i=ya;i<yb;i++)
				printf("%d %d\n",xb,i);
			for(int i=xb;i<xc;i++)
				printf("%d %d\n",i,yb);
			for(int i=yb;i<=yc;i++)
				printf("%d %d\n",xc,i);
		}
		else{
			for(int i=xa;i<xb;i++)
				printf("%d %d\n",i,ya);
			for(int i=ya;i>yb;i--)
				printf("%d %d\n",xb,i);
			for(int i=xb;i<xc;i++)
				printf("%d %d\n",i,yb);
			for(int i=yb;i>=yc;i--)
				printf("%d %d\n",xc,i);
		}
	}
	else{
		int ymax=max(max(ya,yb),yc),ymin=min(min(ya,yb),yc);
		printf("%d\n",xc-xa+ymax-ymin+1);
		if(yb<min(ya,yc)){
			if(ya<=yc){
				for(int i=xa;i<xc;i++)
					printf("%d %d\n",i,ya);
				for(int i=ya;i<=yc;i++)
					printf("%d %d\n",xc,i);
				for(int i=yb;i<ya;i++)
					printf("%d %d\n",xb,i);
			}
			else{
				for(int i=ya;i>=yc;i--)
					printf("%d %d\n",xa,i);
				for(int i=xa+1;i<=xc;i++)
					printf("%d %d\n",i,yc);
				for(int i=yb;i<yc;i++)
					printf("%d %d\n",xb,i);
			}
		}
		else{
			if(ya<=yc){
				for(int i=ya;i<=yc;i++)
					printf("%d %d\n",xa,i);
				for(int i=xa+1;i<=xc;i++)
					printf("%d %d\n",i,yc);
				for(int i=yc+1;i<=yb;i++)
					printf("%d %d\n",xb,i);
			}
			else{
				for(int i=xa;i<xc;i++)
					printf("%d %d\n",i,ya);
				for(int i=ya;i>=yc;i--)
					printf("%d %d\n",xc,i);
				for(int i=ya+1;i<=yb;i++)
					printf("%d %d\n",xb,i);
			}
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int xa,ya,xb,yb,xc,yc;
int main(){
	scanf("%d%d%d%d%d%d",&xa,&ya,&xb,&yb,&xc,&yc);
	if(xa>xb || xa==xb && ya>yb) swap(xa,xb),swap(ya,yb);
	if(xa>xc || xa==xc && ya>yc) swap(xa,xc),swap(ya,yc);
	if(xb>xc || xb==xc && yb>yc) swap(xb,xc),swap(yb,yc);
	if(yb>=min(ya,yc) && yb<=max(ya,yc)){
		int ymax=max(max(ya,yb),yc),ymin=min(min(ya,yb),yc);
		printf("%d\n",xc-xa+ymax-ymin+1);
		if(ya<=yc){
			for(int i=xa;i<xb;i++)
				printf("%d %d\n",i,ya);
			for(int i=ya;i<yb;i++)
				printf("%d %d\n",xb,i);
			for(int i=xb;i<xc;i++)
				printf("%d %d\n",i,yb);
			for(int i=yb;i<=yc;i++)
				printf("%d %d\n",xc,i);
		}
		else{
			for(int i=xa;i<xb;i++)
				printf("%d %d\n",i,ya);
			for(int i=ya;i>yb;i--)
				printf("%d %d\n",xb,i);
			for(int i=xb;i<xc;i++)
				printf("%d %d\n",i,yb);
			for(int i=yb;i>=yc;i--)
				printf("%d %d\n",xc,i);
		}
	}
	else{
		int ymax=max(max(ya,yb),yc),ymin=min(min(ya,yb),yc);
		printf("%d\n",xc-xa+ymax-ymin);
		if(yb<min(ya,yc)){
			if(ya<=yc){
				for(int i=xa;i<xc;i++)
					printf("%d %d\n",i,ya);
				for(int i=ya;i<=yc;i++)
					printf("%d %d\n",xc,i);
				for(int i=yb;i<ya;i++)
					printf("%d %d\n",xb,i);
			}
			else{
				for(int i=ya;i>=yc;i--)
					printf("%d %d\n",xa,i);
				for(int i=xa+1;i<=xc;i++)
					printf("%d %d\n",i,yc);
				for(int i=yb;i<yc;i++)
					printf("%d %d\n",xb,i);
			}
		}
		else{
			if(ya<=yc){
				for(int i=ya;i<=yc;i++)
					printf("%d %d\n",xa,i);
				for(int i=xa+1;i<=xc;i++)
					printf("%d %d\n",i,yc);
				for(int i=yc+1;i<=yb;i++)
					printf("%d %d\n",xb,i);
			}
			else{
				for(int i=xa;i<xc;i++)
					printf("%d %d\n",i,ya);
				for(int i=ya;i>=yc;i--)
					printf("%d %d\n",xc,i);
				for(int i=ya+1;i<=yb;i++)
					printf("%d %d\n",xb,i);
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=500005;
typedef pair<int,int> pii;
#define mk make_pair
pii a[4];
vector<pii> ans;

void path(pii from,pii to)
{
    for(int i=from.first+1;i<=to.first;i++) ans.push_back(mk(i,from.second));
    if(from.second>to.second)
        for(int i=from.second-1;i>=to.second;i--) ans.push_back(mk(to.first,i));
    else
        for(int i=from.second+1;i<=to.second;i++) ans.push_back(mk(to.first,i));
}

int main()
{
    for(int i=1;i<=3;i++) scanf("%d%d",&a[i].first,&a[i].second);
    sort(a+1,a+4);
    if(a[1].second>a[2].second)
    {
        for(int i=a[1].first+1;i<=a[2].first;i++) ans.push_back(mk(i,a[1].second));
        for(int i=a[1].second-1;i>=a[2].second;i--) ans.push_back(mk(a[2].first,i));
    }
    else
    {
        for(int i=a[1].first+1;i<=a[2].first;i++) ans.push_back(mk(i,a[1].second));
        for(int i=a[1].second+1;i<=a[2].second;i++) ans.push_back(mk(a[2].first,i));
    }

    if(a[3].second>=min(a[1].second,a[2].second)&&a[3].second<=max(a[1].second,a[2].second))
        path(mk(a[2].first,a[3].second),a[3]);
    else if(a[3].second>a[3].second<=max(a[1].second,a[2].second))
        path(mk(a[2].first,max(a[2].second,a[1].second)),a[3]);
    else path(mk(a[2].first,min(a[2].second,a[1].second)),a[3]);
    ans.push_back(a[1]);
    printf("%d\n",(int)ans.size());
    for(int i=0;i<(int)ans.size();i++) printf("%d %d\n",ans[i].first,ans[i].second);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=500005;
typedef pair<int,int> pii;
#define mk make_pair
pii a[4];
vector<pii> ans;

void path(pii from,pii to)
{
    for(int i=from.first+1;i<=to.first;i++) ans.push_back(mk(i,from.second));
    if(from.second>to.second)
        for(int i=from.second-1;i>=to.second;i--) ans.push_back(mk(to.first,i));
    else
        for(int i=from.second+1;i<=to.second;i++) ans.push_back(mk(to.first,i));
}

int main()
{
    for(int i=1;i<=3;i++) scanf("%d%d",&a[i].first,&a[i].second);
    sort(a+1,a+4);
    if(a[1].second>a[2].second)
    {
        for(int i=a[1].first+1;i<=a[2].first;i++) ans.push_back(mk(i,a[1].second));
        for(int i=a[1].second-1;i>=a[2].second;i--) ans.push_back(mk(a[2].first,i));
    }
    else
    {
        for(int i=a[1].first+1;i<=a[2].first;i++) ans.push_back(mk(i,a[1].second));
        for(int i=a[1].second+1;i<=a[2].second;i++) ans.push_back(mk(a[2].first,i));
    }

    if(a[3].second>=min(a[1].second,a[2].second)&&a[3].second<=max(a[1].second,a[2].second))
        path(mk(a[2].first,a[3].second),a[3]);
    else if(a[3].second>max(a[1].second,a[2].second))
        path(mk(a[2].first,max(a[2].second,a[1].second)),a[3]);
    else path(mk(a[2].first,min(a[2].second,a[1].second)),a[3]);
    ans.push_back(a[1]);
    printf("%d\n",(int)ans.size());
    for(int i=0;i<(int)ans.size();i++) printf("%d %d\n",ans[i].first,ans[i].second);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f first
#define s second
int n;
int main()
{
	int n = 3;
	pair<int, int> p[n];
	set<pair<int, int> > s;
	for(int i=0; i<n; i++) cin >> p[i].f >> p[i].s;
	sort(p, p+n);
	int x = p[0].f, y = p[0].s;
	while(x < p[1].f)
	{
		s.insert({x, y});
		x++;
	}
	while(y != p[1].s)
	{
		s.insert({x, y});
		if(p[1].s < y) y--;
		else y++;
	}
	while(y != p[2].s)
	{
		s.insert({x, y});
		if(p[2].s < y) y--;
		else y++;
	}
	while(x != p[2].f)
	{
		s.insert({x, y});
		if(p[2].f < x) x--;
		else x++;
	}
	s.insert({x, y});
	cout << s.size() << endl;
	for(auto i : s) cout << i.f << " " << i.s << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ordered_set                                                            \
  tree<int, null_type, less<int>, rb_tree_tag,                                 \
       tree_order_statistics_node_update>
#define ll long long int
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pdd pair<ld, ld>
bool f[2000][2000];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll i;
    pair<ll,ll> v[10];
    for(i=0;i<3;i++)
        cin>>v[i].ff>>v[i].ss;
    sort(v,v+3);
    for(i=0;i<1;i++)
    {
        for(ll j=v[i].ff;j<=v[i+1].ff;j++)
        {
            f[j][v[i].ss]=1;
        }
        for(ll j=min(v[i].ss,v[i+1].ss);j<=max(v[i].ss,v[i+1].ss);j++)
        {
            f[v[i+1].ff][j]=1;
        }
    }
    for (ll j = v[1].ff; j <= v[2].ff; j++) {
      f[j][v[2].ss] = 1;
    }
    for (ll j = min(v[2].ss, v[1].ss); j <= max(v[2].ss, v[1].ss);
         j++) {
      f[v[1].ff][j] = 1;
    }
    ll ans=0;
    for(i=0;i<=1000;i++)
        for(ll j=0;j<=1000;j++)
            if(f[i][j])
                ans++;
    cout<<ans<<"\n";
    for(i=0;i<=1000;i++)
        for(ll j=0;j<=1000;j++)
            if(f[i][j])
                cout<<i<<" "<<j<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define debug(...) fprintf(stderr, __VA_ARGS__)

vector<ii> reza;

int main()
{
  ii a, b, c;
  scanf("%d%d%d%d%d%d", &a.X, &a.Y, &b.X, &b.Y, &c.X, &c.Y);
  if (a.X > b.X) swap(a, b);
  if (a.X > c.X) swap(a, c);
  if (b.X > c.X) swap(b, c);
  for (int i = a.X; i <= b.X; i++) reza.pb({i, a.Y});
  if (a.Y < b.Y) for (int i = a.Y + 1; i <= b.Y; i++) reza.pb({b.X, i});
  else if (a.Y > b.Y) for (int i = b.Y; i < a.Y; i++) reza.pb({b.X, i});
  int mn = min(a.Y, b.Y), mx = max(a.Y, b.Y);
  if (c.Y > mx) {
    for (int i = b.X + 1; i <= c.X; i++) reza.pb({i, mx});
    for (int i = mx + 1; i <= c.Y; i++) reza.pb({c.X, i});
  }
  else if (c.Y < mn) {
    for (int i = b.X + 1; i <= c.X; i++) reza.pb({i, mn});
    for (int i = mn - 1; i >= c.Y; i--) reza.pb({c.X, i});
  }
  else {
    for (int i = b.X + 1; i <= c.X; i++) reza.pb({i, c.Y});
  }
  printf("%d\n", reza.size());
  for (ii i: reza)
    printf("%d %d\n", i.X, i.Y);
  return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int answ;
struct e
{
    int x;
    int y;
}p[3], fin, afis[3003];

bool modx(e a, e b)
{
    return a.x<b.x;
}
bool mody(e a, e b)
{
    return a.y<b.y;
}
int main()
{
    for(int i=0; i<3; i++)
        cin>>p[i].x>>p[i].y;

    sort(p,p+3,modx);
    fin.x=p[1].x;

    sort(p,p+3,mody);
    fin.y=p[1].y;

    answ++;
    afis[answ]=fin;

    for(int i=0; i<3; i++)
    {
        if(p[i].x==fin.x&&p[i].y==fin.y)
            continue;
        answ++;
        afis[answ]=p[i];
        while(p[i].x>fin.x)
        {
            p[i].x--;
            if(p[i].x==fin.x&&p[i].y==fin.y)
                break;
            answ++;
            afis[answ]=p[i];
        }
        while(p[i].x<fin.x)
        {
            p[i].x++;
            if(p[i].x==fin.x&&p[i].y==fin.y)
                break;
            answ++;
            afis[answ]=p[i];
        }
        while(p[i].y>fin.y)
        {
            p[i].y--;
            if(p[i].x==fin.x&&p[i].y==fin.y)
                break;
            answ++;
            afis[answ]=p[i];
        }
        while(p[i].y<fin.y)
        {
            p[i].y++;
            if(p[i].x==fin.x&&p[i].y==fin.y)
                break;
            answ++;
            afis[answ]=p[i];
        }
    }
    cout<<answ<<"\n";
    for(int i=1; i<=answ; i++)
        cout<<afis[i].x<<" "<<afis[i].y<<"\n";

    return 0;
}


#include<bits/stdc++.h>
#define ri register int
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int x[3],y[3],X[3],Y[3];
struct Pot{int x,y;}p[3];
inline bool cmp(const Pot&a,const Pot&b){return a.y==b.y?a.x<b.x:a.y<b.y;}
int main(){
	for(ri i=0;i<3;++i)p[i].x=x[i]=read(),p[i].y=y[i]=read();
	sort(x,x+3),sort(y,y+3),sort(p,p+3,cmp);
	int cnt=0;
	vector<pair<int,int> >ans;
	for(ri i=x[0];i<=x[2];++i)ans.push_back(make_pair(i,y[1]));
	for(ri i=y[0];i<y[1];++i)ans.push_back(make_pair(p[0].x,i));
	for(ri i=y[1]+1;i<=y[2];++i)ans.push_back(make_pair(p[2].x,i));
	cout<<ans.size()<<'\n';
	for(ri i=0;i<ans.size();++i)cout<<ans[i].first<<' '<<ans[i].second<<'\n';
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int calcDistance(int x1, int y1, int x2, int y2)
{
	return int(sqrt(pow((x2 - x1),2) + (pow((y2 - y1),2))));
}

int calcDistanceFast(int x0, int y0)
{

}

long sumLines(int n)
{
	long sum = 0;
	for (long i = 1; i <= n; i++) sum += i;
	return sum;
}

int main()
{
	int qnt;
	cin >> qnt;

	for (int cnt = 0; cnt < qnt; cnt++)
	{
		long steps = 0;
		int n;
		cin >> n;
		int x0 = trunc(n/2)+1, y0 = x0;
		steps = steps + 4 * sumLines(trunc(n / 2));

		for (int i=1;i<=x0-1;i++)
			for (int j = 1; j <= y0-1; j++)
			{
				int t = calcDistance(i, j, x0, y0);
				steps += t*4;
			}
		cout << steps << endl;
	}

	return 0;
}


#include <iostream>
#include <math.h>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <set>
#include <algorithm>
typedef long long ll;
typedef long double ld;
typedef double db;
using namespace std;
void fun()
{
	ll n, sum = 0, k = 8;
	cin >> n;
	for (ll i = 1; i <= n / 2; i++){
		sum += k * i;
		k *= 2;
	}
	cout << sum << endl;
}
int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		fun();
	}
}


#include <iostream>
#include <math.h>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <set>
#include <algorithm>
typedef long long ll;
typedef long double ld;
typedef double db;
using namespace std;
void fun()
{
	ll n, sum = 0, k = 8;
	cin >> n;
	for (ll i = 1; i <= n / 2; i++){
		sum += k * i;
		k += 8;
	}
	cout << sum << endl;
}
int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		fun();
	}
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int t,n;
int main()
{
	cin >> t;
	while(t--)
	{
    	cin >> n;
    	if(n==1)
		{
			cout << "0" << endl;
			continue;
		}
    	long long sum = 0;
		long long node = n/2;
   		for(long long i = 1; i <= node; i++)
    		sum += i*i;
    	sum *= 8;
    	cout << sum << endl;
 	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int t,n;
int main()
{
	cin >> t;
	while(t--)
	{
    	cin >> n;
    	if(n==1)
		{
			cout << "0" << endl;
			continue;
		}
    	long long sum = 0;
		long long node = (n-1)/2;
   		for(long long i = 1; i <= node; i++)
    		sum += i * i * 8 ;
    	cout << sum << endl;
 	}
	return 0;
}


#include<iostream>
#include<vector>
#include<cmath>
#include<iterator>
#include<algorithm>

using namespace std;

int main() {
	int n, t, m, k;
	cin >> t;
	for (int i = 0; i < t; i++) {
		int q = 0;
		cin >> n;
		for (int j = 1; j <= n / 2; j++) {
			q += 8 * j * j;
		}
		cout << q << endl;
	}
}


#include<iostream>
#include<vector>
#include<cmath>
#include<iterator>
#include<algorithm>

using namespace std;

int main() {
	int n, t, m, k;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long int q = 0;
		cin >> n;
		for (int j = 1; j <= n / 2; j++) {
			q += 8 * j * j;
		}
		cout << q << endl;
	}
}


#include<iostream>
#include<vector>
#include<cmath>
#include<iterator>
#include<algorithm>

using namespace std;

int main() {
	int n, t, m, k;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long q = 0;
		cin >> n;
		for (long long int j = 1; j <= n / 2; j++) {
			q += 8 * j * j;
		}
		cout << q << endl;
	}
}


#include<iostream>
#include<vector>
#include<cmath>
#include<iterator>
#include<algorithm>

using namespace std;

int main() {
	int n, t, m, k;
	cin >> t;
	for (int i = 0; i < t; i++) {
		double q = 0;
		cin >> n;
		for (int j = 1; j <= n / 2; j++) {
			q += 8 * j * j;
		}
		cout << q << endl;
	}
}


// c.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

void solve() {
	int n;
	cin >> n;

	long long m = n / 2;
	cout << 8 * (m * (m + 1) * (2 * m + 1)) / 6 << "\n";
}

int main()
{
	int t;
	cin >> t;

	while (t--) {
		solve();
	}
}


#include <iostream>
#include <string>
#include<deque>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<tuple>

#define maxn 500001
#define LL long long
#define inf 1000000000

using namespace std;

struct edge {
	int dis;
	int st;
	int ed;

	edge(int dis, int st, int ed) {
		this->dis = dis;
		this->st = st;
		this->ed = ed;
	}
	bool operator < (const edge& rhs)const {
		if (dis == rhs.dis) {
			if (st == rhs.st)
				return ed < rhs.ed;
			return st < rhs.st;
		}
		return dis < rhs.dis;

	}
};
bool desc(int a, int b) { return a > b; }
int gcd(int a, int b) {
	if (a < b) swap(a, b);
	while (!b == 0) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}
//int getParent(int set[], int x) {
//	if (set[x] == x)return x;
//	return set[x] = getParent(set, set[x]);
//}
//void unionParent(int set[], int a, int b) {
//	a = getParent(set, a);
//	b = getParent(set, b);
//
//	if (a < b)set[b] = a;
//	else set[a] = b;
//
//}
//
//int find(int set[], int a, int b) {
//	a = getParent(set, a);
//	b = getParent(set, b);
//	if (a == b)return 1;
//	else return 0;
//}
//int krusckal(int num) {
//	int sum = 0;
//	int set[maxn];
//	for (int i = 1; i <= num; ++i) {
//		set[i] = i;
//	}
//	for (auto it = S.begin(); it !=S.end(); ++it) {
//		if (!find(set,(*it).st, (*it).ed)) {
//			sum += (*it).dis;
//			unionParent(set, (*it).st, (*it).ed);
//		}
//	}
//
//	for (int i = 1; i <= num; ++i) {
//		getParent(set, i);
//	}
//	bool flg = true;
//	int parent = set[1];
//	for (int i = 2; i <= num; ++i) {
//		if (parent != set[i])
//			return -1;
//	}
//	return sum;
//}

int n, m;
int ans;
int dx[9] = { -1,0,1,0,0,1,1,-1,-1 };
int dy[9] = { 0,1,0,-1,0,1,-1,1,-1 };
unsigned LL arr[maxn];

int main() {

	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t;
	cin >> t;
	LL tmp = 8;
	LL mul = 1;
	for (int i = 3; i < maxn; i += 2) {
		arr[i] = arr[i - 2] + (tmp*mul);
		tmp += 8;
		mul++;
	}
	for (int test_case = 0; test_case < t; ++test_case) {
		int n;
		cin >> n;

		ans = 0;

		cout << arr[n] << '\n';
		//cout << '#' << test_case+1 << ' ' << ans << '\n';
	}
	return 0;
}


#define ll long long
using namespace std;
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
	int t; scanf("%d", &t);
	for (int i = 0; i < t; i++)
	{
		int n; scanf("%d", &n);
		ll m = (n - 1) / 2;
		ll res = (m * (m + 1)*(2 * m + 1)) / 6;
		printf("%lld%s", 8 * res, "\n");
	}
}


#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
typedef long long int ll;
//#include<bits/stdc++.h>

using namespace std;

int main()
{

    int q;
    cin >> q;
    while (q--) {
        ll n;
        cin >> n;

        ll p = 0;
        for (ll i = 1; i <= n / 2; i++) {
            p += (i ) * (1 + 2*i-1) * 4;
        }
        if (n % 2 == 0)p -= (n / 2) * (1 + 2 * (n / 2) - 1);

        cout << p << endl;

    }

    return 0;

}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <cmath>
#include <limits>
#include <list>
#include <memory>
#include <stack>
#include <iterator>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;

#pragma GCC optimize("Ofast")
#define ll long long
#define V vector
#define pp pair<ll,ll>
#define pi 3.1416
#define inf 1000000000000
#define max2(a,b) ((a<b)?b:a)
#define max3(a,b,c) max2(max2(a,b),c)
#define min2(a,b) ((a>b)?b:a)
#define min3(a,b,c) min2(min2(a,b),c)
#define what_is(x) cerr << #x << " is " << x << endl;
#define PS(x) push_back(x)

void solve() {
	ll n;
	cin >> n;
	ll a = 0;
	for (ll i = 1; i <= (n-1) / 2; i++) {
		a += i * i;
	}
	cout << a * 8 << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t; cin >> t;
	while (t--)
		solve();
	return 0;
}

/**/


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <cmath>
#include <limits>
#include <list>
#include <memory>
#include <stack>
#include <iterator>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;

#pragma GCC optimize("Ofast")
#define ll long long
#define V vector
#define pp pair<ll,ll>
#define pi 3.1416
#define inf 1000000000000
#define max2(a,b) ((a<b)?b:a)
#define max3(a,b,c) max2(max2(a,b),c)
#define min2(a,b) ((a>b)?b:a)
#define min3(a,b,c) min2(min2(a,b),c)
#define what_is(x) cerr << #x << " is " << x << endl;
#define PS(x) push_back(x)

void solve() {
	int n;
	cin >> n;
	ll a = 0;
	for (ll i = 1; i <= n / 2; i++) {
		a += i * i;
	}
	cout << a * 8 << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t; cin >> t;
	while (t--)
		solve();
	return 0;
}

/**/


#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

long long gcd(long long a, long long b) {
	if (b > a) {
		swap(a, b);
	}

	while (a && b) {
		a = a % b;
		swap(a, b);
	}

	return a;

}

int main() {
	long long t = 0;
	cin >> t;

	for (long long i = 0; i < t; ++i) {

		long long n;
		cin >> n;

		long long x = 0;
		for (long long i = 3; i <= n; i += 2) {
			long long temp = i / 2;
			x += temp * (4 * i - 4);
		}

		cout << x << endl;
	}

	return 0;
}


#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
void solve()
{
	int n; long long x = 0; long long y = 0;
	cin >> n;
	while (n > 1)
	{
		x += (n - 1) * 4 + y;
		y += (n - 1) * 4;
		n = n - 2;
	}
	cout << x << endl;
}

int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; ++i)
	{
		solve();
	}
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	long long t;
	cin>>t;
	while(t--)
	{
		long long n;
		cin>>n;
		if(n==1) cout<<0<<endl;
		else if(n==3) cout<<8<<endl;
		else
		{
			long long x=n/2;
			long long y=x-1;
			long long sum1=(x+x*x)/2*8;//8����Խ���
			long long sum2=0;
			for(long long i=1;i<=y;i++)
				sum2+=8*i*(i+1);//��ɫ���ĺ�
			cout<<sum1+sum2<<endl;
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		if(n==1) cout<<0<<endl;
		else if(n==3) cout<<8<<endl;
		else
		{
			int x=n/2;
			int y=x-1;
			long long sum1=(x+x*x)/2*8;
			long long sum2=0;
			for(int i=1;i<=y;i++)
				sum2+=8*i*(i+1);
			cout<<sum1+sum2<<endl;
		}
	}
	return 0;
}


int main()
{
    int t;
    cin >> t;
    for (int z = 0; z < t; z++)
    {
       long long int n, level = 0, tot_moves = 0;
        cin >> n;
        n=(n-1)/2;
        for (int i = 1; i <= n; i++)
        {
            level = 8 * (i);
            tot_moves =tot_moves + level * (i);
        }
        cout << tot_moves << endl;
    }

    return 0;
}


#include <iostream>
#include <array>

using namespace std;

int main()
{
    int t;
    cin >> t;
    for (int z = 0; z < t; z++)
    {
       long int n, level = 0, tot_moves = 0;
        cin >> n;
        n=(n-1)/2;
        for (int i = 1; i <= n; i++)
        {
            level = 8 * (i);
            tot_moves =tot_moves + level * (i);
        }
        cout << tot_moves << endl;
    }

    return 0;
}


#include <iostream>
#include <array>

using namespace std;

int main()
{
    int t;
    cin >> t;
    for (int z = 0; z < t; z++)
    {
       long long int n, level = 0, tot_moves = 0;
        cin >> n;
        n=(n-1)/2;
        for (int i = 1; i <= n; i++)
        {
            level = 8 * (i);
            tot_moves =tot_moves + level * (i);
        }
        cout << tot_moves << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int n;
	    cin>>n;
	    long long sum=0;
	    for(int i=1;i<=(n/2);i++){
	        sum+=1ll*i*i;
	    }
	    cout<<8*sum<<endl;
	}
	return 0;
}


//
//  problem1355A.cpp
//  competitiveprogramming
//
//  Created by Henry Cafaro on 6/17/20.
//  Copyright © 2020 Henry Cafaro. All rights reserved.
//

# include <iostream>
# include <string>

using namespace std;

int t, n;

void solve(){
    cin >> n;
    long long int l = (n-1)/2;
    cout << 8*l*(l+1)*(2*l+1)/6 << endl;
}

int main() {

    cin >> t;

    for (int i = 0; i < t; i++) solve();

}


#include<iostream>
using namespace std;
int main()
{
	int t;
	cin >> t;
	for (int j = 0; j < t; j++)
	{
		int n;
		cin >> n;
		long long int sum = 0;
		long long int a = 1;
		for (int i = 1; i < (n + 1 / 2); i = i + 2)
		{

			long long int temp = (a * a * 8);
			sum += temp;
			a++;
		}

		cout << sum;
		if(j!=t-1)
		cout << endl;
	}

}


#include<iostream>
using namespace std;
int main()
{
	int t;
	cin >> t;
	for (int j = 0; j < t; j++)
	{
		int n;
		cin >> n;
		double sum = 0;
		double a = 1;
		for (int i = 1; i < (n + 1 / 2); i = i + 2)
		{

			double temp = (double)(a * a * 8);
			sum += temp;
			a++;
		}

		cout << sum;
		if(j!=t-1)
		cout << endl;
	}

}


#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double sum = 0;
	double a = 1;
	for (int i = 1; i <(n + 1 / 2); i=i+2)
	{

		double temp = (double)(a * a * 8);
		sum += temp;
		a++;
	}

	cout << sum;

}


#include<iostream>
using namespace std;
int main()
{
	int t;
	for (int j = 0; j < t; j++)
	{
		int n;
		cin >> n;
		double sum = 0;
		double a = 1;
		for (int i = 1; i < (n + 1 / 2); i = i + 2)
		{

			double temp = (double)(a * a * 8);
			sum += temp;
			a++;
		}

		cout << sum;
		if(j!=t-1)
		cout << endl;
	}

}


#include<iostream>
using namespace std;
int main()
{
	int t;
	for (int j = 0; j < t; j++)
	{
		int n;
		cin >> n;
		double sum = 0;
		double a = 1;
		for (int i = 1; i < (n + 1 / 2); i = i + 2)
		{

			double temp = (double)(a * a * 8);
			sum += temp;
			a++;
		}

		cout << sum;
		cout << endl;
	}

}


#include<iostream>
#include <stdint.h>
using namespace std;

int main(){
    int t;
    cin >>t;
    for(int i=0;i<t; i++ )
    {
        int64_t n,k,o;
        cin >>n;
        k=n/2;
        o=4*(k*((2*k)+1)*(k+1))/3;
        cout <<o<<endl;
    }
    return 0;

}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int i;
    int n;
    for(i=0;i<t;i++)
    {
        cin>>n;
        if(n==1)
        {
            cout<<0<<"\n";
        }
        else
        if(n==3)
        {
            cout<<8<<"\n";
        }
        else
        {
        n=n/2;
        cout<<8*n*(n+1)*(2*n+1)/6<<"\n";
    }
}}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int i;
   long long int n;
    for(i=0;i<t;i++)
    {
        cin>>n;
        if(n==1)
        {
            cout<<0<<"\n";
        }
        else
        if(n==3)
        {
            cout<<8<<"\n";
        }
        else
        {
        n=n/2;
        cout<<8*n*(n+1)*(2*n+1)/6<<"\n";
    }
}}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int i;
    int n;
    for(i=0;i<t;i++)
    {
        cin>>n;
        if(n==1)
        {
            cout<<0<<"\n";
        }
        else
        if(n==3)
        {
            cout<<8<<"\n";
        }
        else
        {
        n=n/2;
        cout<<(8*n*(n+1)*(2*n+1))/6<<"\n";
    }
}}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int i;
    int n;
    for(i=0;i<t;i++)
    {
        cin>>n;
        if(n==1)
        {
            cout<<0<<"\n";
        }
        else
        if(n==3)
        {
            cout<<8<<"\n";
        }
        else
        {
        n=n/2;
        cout<<8*n*(n+1)*(2*n+1)/6<<"\n";
    }
}


#include <iostream>
#include <fstream>
#include <istream>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include<queue>
#define ll long long
#define mp(x,y) make_pair(x,y)
#define read(x) cin>>x;
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define yes "YES"
#define no "NO"
#define alice "Alice"
#define bob "Bob"
using namespace std;

ll prepare(ll n){
	ll left = 2,up = 1;

	ll sum = 0 ;
	ll weight = 1;
	for(ll i = 1;i<=n-1;i++){
		sum += (left+up)*weight;
		weight++;
		left++;
		up++;
	}

	return sum ;
}

ll fact(ll n ){
	ll sum  = 0 ;
	for(int i = 1 ;i<=n;i++){
		sum += i;
	}
	return sum ;
}

ll solve(ll n){
	ll p = prepare(n/2 + 1);
	//cout<<p<<endl;
	ll minus = fact(n/2);
	//cout<<minus<<endl;
	return p*4 - minus*4;
}

int main(){
	int T;
	read(T);
	while(T--){
		ll n ;
		read(n);
		if(n == 1){
			cout<<0<<endl;
			continue;
		}
		cout<<solve(n)<<endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int t; cin >> t;
	while (t) {
		long long n, k = 0, i, j, x; cin >> n;
		x = n / 2;
		for (i = 1; i <= x; i++)
			k += i * 8 * i;
		cout << k << '\n';
		t--;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int t; cin >> t;
	while (t) {
		long long n, k = 0, i, j, x; cin >> n;
		x = n / 2 + 1;
		for (i = 1; i <= n; i++)
			for (j = 1; j <= n; j++)
				k += max(abs(x - i), abs(x - j));
		cout << k << '\n';
		t--;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int t; cin >> t;
	while (t) {
		long long n, k = 1, i, j, x; cin >> n;
		x = n / 2 + 1;
		for (i = 2; i <= n; i++)
			k += i * 4 * (i - 1);
		cout << k << '\n';
		t--;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int t; cin >> t;
	while (t) {
		long long n, k = 0, i, j, x; cin >> n;
		x = n / 2 + 1;
		for (i = 2; i <= n; i++)
			k += i * 4 * (i - 1);
		cout << k << '\n';
		t--;
	}
}


#include <iostream>
#include <sstream>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <ctime>
#include <algorithm>
#include <bitset>
using namespace std;

int main()
{
	int t;
	cin >> t;

	while (t--) {
		long long int n, s, ps = 1, ans = 0;
		cin >> n;

		for (long long int i = 1; (2 * i + 1) * (2 * i + 1) <= n * n; i++) {
			s = (2 * i + 1) * (2 * i + 1);
			ans += (s - ps) * i;
			ps = (2 * i + 1) * (2 * i + 1);
		}
		cout << ans << endl;
	}

	return 0;
}


#include<cstdio>

typedef __int64 ll;

int main(void)
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		ll n;
		scanf("%d", &n);
		ll ceng;
		ceng = (n-1)/2;
		ll ans = 0;

		for( ll i=1; i<=ceng; i++)
		{
			ans += i*i;
		}

		printf("%lld\n", ans*8);

	}
	return 0;
}


#include<cstdio>

typedef __int64 ll;

int main(void)
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int n;
		scanf("%d", &n);
		int ceng;
		ceng = (n-1)/2;
		ll ans = 0;

		for( int i=1; i<=ceng; i++)
		{
			ans += i*i;
		}

		printf("%lld\n", ans*8);

	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int t;cin>>t;
	long long int n;
	while(t--){
	    long long int sum=0;
	    cin>>n;

	    for(long long int i=1;i<=(n-1)/2;i++){
	        sum+=(i*i*8);

	    }
	    cout<<sum<<endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int t;cin>>t;
	long long int n;
	while(t--){
	    long long int sum=0;
	    cin>>n;
	    if(n==1){
	        cout<<1<<endl;continue;
	    }
	    for(long long int i=1;i<=(n-1)/2;i++){
	        sum+=(i*i*8);

	    }
	    cout<<sum<<endl;
	}
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
long long dp[500005];
int main(void) {
	int t;
	scanf("%d", &t);
	dp[1] = 0;
	for (long long i = 3; i < 500000; i++) {
		if (i & 1) {
			dp[i] = dp[i - 2] + 4 * (i - 1)*(i / 2);
		}
	}
	while (t--) {
		long long n;
		scanf("%lld", &n);
		printf("%lld\n", dp[n]);
	}
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
long long dp[500005];
int main(void) {
	int t;
	scanf("%d", &t);
	dp[1] = 0;
	for (long long i = 3; i < 500000; i+=2) {
		if (i & 1) {
			dp[i] = dp[i - 2] + 4 * (i - 1)*(i / 2);
		}
	}
	while (t--) {
		long long n;
		scanf("%lld", &n);
		printf("%lld\n", dp[n]);
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        long n,a=8;
        cin >> n;
        if (n == 1)
            cout << 0 << endl;
        else
        {
            long long int sum=0;
            for (long i = 1; i <= n/2; i++)
            {
                sum += i * a;
                a = a + 8;
            }
            cout << sum << endl;
        }
    }
}


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        long n,a=8;
        cin >> n;
        if (n == 1)
            cout << 0 << endl;
        else
        {
            long long int sum=0;
            for (size_t i = 1; i <= n/2; i++)
            {
                sum += i * a;
                a = a + 8;
            }
            cout << sum << endl;
        }
    }
}


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        long n,a=8;
        cin >> n;
        if (n == 1)
            cout << 0 << endl;
        else
        {
            long long int sum=0;
            for (long long i = 1; i < n/2+1; i++)
            {
                sum =sum +  i * a;
                a = a + 8;
            }
            cout << sum << endl;
        }
    }
}


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        long n,a=8;
        cin >> n;
        if (n == 1)
            cout << 0 << endl;
        else
        {
            long long int sum=0;
            for (size_t i = 0; i <= n/2; i++)
            {
                sum += i * a;
                a = a + 8;
            }
            cout << sum << endl;
        }
    }
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<math.h>
#include<utility>
#include<iomanip>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		unsigned long long ans = 0;
		int x = n / 2;
		for (unsigned long long i = 0; i <= x; i++) {
			ans += i * i * 8ul;
		}
		cout << ans << '\n';
	}

}


#include <iostream>
#include <vector>
#include <sstream>
#include <string>
#include <algorithm>
#include <cctype>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <bitset>
#include <numeric>
#include <string>
#include <functional>

int main()
{
	std::string answerStr = "";
	int answerInt = 0;
	double answerDouble = 0;
	int MOD = 1000000007;
	int t;

	std::cin >> t;

	for (int i = 0; i < t; ++i)
	{
		int n;
		std::cin >> n;
		long long answer = 0;

		for (int i = 1; i <= n / 2; ++i)
		{
			answer += (long long) i * i;
		}

		std::cout << answer * 8 << std::endl;
	}

	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	long long t;
	cin>>t;
	while(t--)
	{
		long long n;
		cin>>n;
		n=n/2;
		long long ans;
		ans=(8*(n)*(n+1)*(2*n+1))/6;
		cout<<ans<<endl;
	}
}


#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long n;
        cin>>n;
        n=n/2;
        cout<<(long)((n*(n+1)*(2*n+1))/6);
    }
    return 0;
}