#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
/******************* template *****************************/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/******************* end of template *****************************/
mt19937 rnd(time(0));
set<int>queries;
vector<pii>Q;
int32_t main()
{
  BOOST;
  int n,start,x;
  cin>>n>>start>>x;
  for (int i=1;i<=min(n,999LL);i++)
  {
    int pos=rnd()%n+1;
    while (queries.find(pos)!=queries.end())
    {
      pos=rnd()%n+1;
    }
    queries.insert(pos);
    cout<<"? "<<pos<<endl;
    pii rsp;
    cin>>rsp.st>>rsp.nd;
    Q.pb(mp(rsp.st,rsp.nd));
  }

  sort(Q.begin(),Q.end());
  pii strt=mp(-1,-1);
  for (auto it:Q)
  {
    if (it.st<=x)strt=it;
  }
  int ans=-1;

  if (strt.st<x)
  {
    for (int i=1;i<=1000;i++)
    {
      if (strt.nd==-1)break;
      cout<<"? "<<strt.nd<<endl;
      pii rsp;
      cin>>rsp.st>>rsp.nd;
      if ((rsp.st>=x))
      {
        ans=rsp.st;
        break;
      }
      strt.st=rsp.st;
      strt.nd=rsp.nd;
    }
  }
  else ans=strt.st;

  cout<<"! "<<ans<<endl;
  return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
/******************* template *****************************/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/******************* end of template *****************************/
mt19937 rnd(time(0));
set<int>queries;
vector<pii>Q;
int32_t main()
{
  BOOST;
  int n,start,x;
  cin>>n>>start>>x;
  for (int i=1;i<=min(n,999LL);i++)
  {
    int pos=rnd()%n+1;
    while (queries.find(pos)!=queries.end())
    {
      pos=rnd()%n+1;
    }
    queries.insert(pos);
    cout<<"? "<<pos<<endl;
    pii rsp;
    cin>>rsp.st>>rsp.nd;
    Q.pb(mp(rsp.st,rsp.nd));
  }

  sort(Q.begin(),Q.end());
  pii strt=mp(-1,-1);
  for (auto it:Q)
  {
    if (it.st<=x)strt=it;
  }
  int ans=-1;

  if (strt.st==-1)
  {
    cout<<"? "<<start<<endl<<"\n";
    pii rsp;
    cin>>rsp.st>>rsp.nd;
    strt.st=rsp.st;
    strt.nd=rsp.nd;
  }

  if (strt.st<x)
  {
    for (int i=1;i<=1000;i++)
    {
      if (strt.nd==-1)break;
      cout<<"? "<<strt.nd<<endl;
      pii rsp;
      cin>>rsp.st>>rsp.nd;
      if ((rsp.st>=x))
      {
        ans=rsp.st;
        break;
      }
      strt.st=rsp.st;
      strt.nd=rsp.nd;
    }
  }
  else ans=strt.st;

  cout<<"! "<<ans<<endl;
  return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define present(c,x) ((c).find(x) != (c).end())
#define mp make_pair
#define hell 998244353
#define F first
#define S second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
void solve()
{
    ll n , a , b , start , x , st , value = -1 ;
    cin >> n >> start >> x ;
    rep( i , 0 , 1000 ){
        ll id = ( rand()*rand() + rand() + n + 10 ) % (n+1) ;
        if(id<1)
            continue;
        cout << "? " << id << endl ;
        cin >> a >> b ;
        if( a < x && a >= value ){
            st = id ;
            value = a ;
        }
    }
    rep( i , 0 , 999 ){
        cout << "? " << st << endl ;
        cin >> a >> b ;
        if( b == -1 && a < x ){
            cout << "! -1" << endl ;
            exit(0);
        }
        else if( a >= x ){
            cout << "! " << st << endl ;
            exit(0);
        }
        st = b ;
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define present(c,x) ((c).find(x) != (c).end())
#define mp make_pair
#define hell 998244353
#define F first
#define S second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
void solve()
{
    ll n , a , b , start , x , st , value = -1 ;
    cin >> n >> start >> x ;
    st = start ;
    rep( i , 0 , 1000 ){
        ll id = ( rand()*rand() + rand() + n + 10 ) % (n+1) ;
        if(id<1)
            continue;
        cout << "? " << id << endl ;
        cin >> a >> b ;
        if( a < x && a >= value ){
            st = id ;
            value = a ;
        }
    }
    rep( i , 0 , 999 ){
        cout << "? " << st << endl ;
        cin >> a >> b ;
        if( b == -1 && a < x ){
            cout << "! -1" << endl ;
            exit(0);
        }
        else if( a >= x ){
            cout << "! " << a << endl ;
            exit(0);
        }
        st = b ;
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define present(c,x) ((c).find(x) != (c).end())
#define mp make_pair
#define hell 998244353
#define F first
#define S second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
void solve()
{
    ll n , a , b , start , x , st , value = -1 ;
    cin >> n >> start >> x ;
    rep( i , 0 , 1000 ){
        ll id = ( rand()*rand() + rand() + n + 10 ) % (n+1) ;
        if(id<1)
            continue;
        cout << "? " << id << endl ;
        cin >> a >> b ;
        if( a < x && a >= value ){
            st = id ;
            value = a ;
        }
    }
    rep( i , 0 , 999 ){
        cout << "? " << st << endl ;
        cin >> a >> b ;
        if( b == -1 && a < x ){
            cout << "! -1" << endl ;
            exit(0);
        }
        else if( a >= x ){
            cout << "! " << a << endl ;
            exit(0);
        }
        st = b ;
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define present(c,x) ((c).find(x) != (c).end())
#define mp make_pair
#define hell 998244353
#define F first
#define S second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
void solve()
{
    ll n , a , b , start , x , st , value = -1 ;
    cin >> n >> start >> x ;
    rep( i , 0 , 1000 ){
        ll id = ( rand()*rand() + rand() + n + 10 ) % (n+1) ;
        cout << "? " << id << endl ;
        cin >> a >> b ;
        if( a < x && a >= value ){
            st = id ;
            value = a ;
        }
    }
    rep( i , 0 , 999 ){
        cout << "? " << st << endl ;
        cin >> a >> b ;
        if( b == -1 && a < x ){
            cout << "! -1" << endl ;
            exit(0);
        }
        else if( a >= x ){
            cout << "! " << st << endl ;
            exit(0);
        }
        st = b ;
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


#include<bits/stdc++.h>
#define REP(i,j,k) for(int i=j;i<k;++i)
#define RREP(i,j,k) for(int i=(int)j-1;i>=k;--i)
#define int long long
#define pb emplace_back
#define P pair<int,int>
#define F first
#define S second
#define ALL(x) x.begin(),x.end()
#define sz(a) (int)(a).size()
#define MX 50005
#define oo 1e18
#define L d*2
#define R d*2+1
#define mid (l+r>>1)
#define Ls l,mid,d*2
#define Rs mid+1,r,d*2+1
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mo (int)(1e9+7)
#define IOS cin.tie(0) ,cout.tie(0), cout.sync_with_stdio(0)
using namespace std;
int a[MX],n,s,x,qv[MX],qn[MX],p,v,ne;
main(){
	srand(time(0));
	cin>>n>>s>>x;
	REP(i,1,n+1) a[i] = i;
	random_shuffle(a+1,a+1+n);
	REP(i,1,min(n+1,(int)1001)){
		cout<<"? "<<a[i]<<"\n";
		cin>>qv[i]>>qn[i];
		if(qv[i]<x && (!p || qv[p]<qv[i])) p = i;
	}
	p = (p?qn[p]:s);
	REP(i,1,1001){
		if(p==-1) break;
		cout<<"? "<<p<<"\n";
		cin>>v>>ne;
		if(v>=x) return cout<<"! "<<v<<"\n",0;
		p = ne;
	}
	cout<<"! -1";
}


#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef pair<int,int> pii;
#define NN 1010
int x[NN],y[NN];
int vst[NN][NN];
pii p[NN];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	for(int i=1;i<=3;i++){
		scanf("%d%d",&x[i],&y[i]);
		p[i]=pii(x[i],y[i]);
	}
	sort(p+1,p+4);
	for(int i=1;i<=3;i++){
		x[i]=p[i].x;
		y[i]=p[i].y;
	}
	for(int i=1;i<=2;i++){
		int j=i+1;
		int p=x[i],q=y[i];
		vst[p][q]=1;
		while(1){
			if(p==x[j]&&q==y[j]) break;
			if(y[j]>y[i]){
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}
				if(p>x[j]){
					p--;
					vst[p][q]=1;
					continue;
				}
				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
			}
			else{
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
				if(p>x[j]){
					p--;
					vst[p][q]=1;
					continue;
				}
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}

				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}

			}
		}
	}
	int ans=0;
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) ans++;
		}
	}
	printf("%d\n",ans);
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) printf("%d %d\n",i,j);
		}
	}
    return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef pair<int,int> pii;
#define NN 1010
int x[NN],y[NN];
int vst[NN][NN];
pii p[NN];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	for(int i=1;i<=3;i++){
		scanf("%d%d",&x[i],&y[i]);
		p[i]=pii(x[i],y[i]);
	}
	sort(p+1,p+4);
	for(int i=1;i<=3;i++){
		x[i]=p[i].x;
		y[i]=p[i].y;
	}
	for(int i=1;i<=2;i++){
		int j=i+1;
		int p=x[i],q=y[i];
		vst[p][q]=1;
		while(1){
			if(p==x[j]&&q==y[j]) break;
			if(i==1){
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}
				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
			}
			if(i>1){
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}
				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}

			}
		}
	}
	int ans=0;
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) ans++;
		}
	}
	printf("%d\n",ans);
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) printf("%d %d\n",i,j);
		}
	}
    return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef pair<int,int> pii;
#define NN 1010
int x[NN],y[NN];
int vst[NN][NN];
pii p[NN];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	for(int i=1;i<=3;i++){
		scanf("%d%d",&x[i],&y[i]);
		p[i]=pii(x[i],y[i]);
	}
	sort(p+1,p+4);
	for(int i=1;i<=3;i++){
		x[i]=p[i].x;
		y[i]=p[i].y;
	}
	for(int i=1;i<=2;i++){
		int j=i+1;
		int p=x[i],q=y[i];
		vst[p][q]=1;
		while(1){
			if(p==x[j]&&q==y[j]) break;
			if(i==1){
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}
				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
			}
			if(i>1){
				if(q>y[j]){
					q--;
					vst[p][q]=1;
					continue;
				}
				if(q<y[j]){
					q++;
					vst[p][q]=1;
					continue;
				}
				if(p<x[j]){
					p++;
					vst[p][q]=1;
					continue;
				}

			}
		}
	}
	int ans=0;
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) ans++;
		}
	}
	printf("%d\n",ans);
	for(int i=0;i<NN;i++){
		for(int j=0;j<NN;j++){
			if(vst[i][j]) printf("%d %d\n",i,j);
		}
	}
    return 0;
}


#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define inf 0x3f3f3f3f

using namespace std;

typedef double DO;
typedef long long INT;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}
template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}
template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}
int power(int a, int b, int m, int ans=1) {for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;return ans;}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

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

    int mn=inf, x0, y0;
    for(int i=0; i<=1000; i++) for(int j=0; j<=1000; j++){
        int d=0;
        for(int k=0; k<3; k++) d+=abs(x[k]-i)+abs(y[k]-j);
        if(mn>d) mn=d, x0=i, y0=j;
    }

    cout << mn+1 << endl;;

    printf("%d %d\n", x0, y0);
    for(int i=0; i<3; i++){
        int r=x0, c=y0;
        while(r<x[i]) printf("%d %d\n", ++r, c);
        while(r>x[i]) printf("%d %d\n", --r, c);
        while(c<y[i]) printf("%d %d\n", r, ++c);
        while(c>y[i]) printf("%d %d\n", r, --c);
    }

	return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define x first
#define y second

using namespace std;
template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}
template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

typedef double DO;
typedef long long INT;
typedef pair<int, int> pii;
typedef vector<int> VI;

int x[4], y[4];
int a[4];

int go(int a, int b, int c, int d) {
	return abs(a-c) + abs(b-d);
}

void disp(int a, int b, int c, int d) {
	while(a<c) printf("%d %d\n", a, b), a++;
	while(a>c) printf("%d %d\n", a, b), a--;
	while(b<d) printf("%d %d\n", a, b), b++;
	while(b>d) printf("%d %d\n", a, b), b--;
}

void solve() {
	for(int i=0; i<3; i++) {
		cin >> x[i] >> y[i];
	}
	for(int i=0; i<3; i++) a[i] = i;
	int mn=1e9;
	for(int i=0; i<=1000; i++) {
		for(int j=0; j<=1000; j++) {
			int tmp=0;
			for(int k=0; k<3; k++) tmp += go(x[k], y[k], i, j);
			smin(mn, tmp);
		}
	}
	cout << mn+1 << endl;
	for(int i=0; i<=1000; i++) {
		for(int j=0; j<=1000; j++) {
			int tmp=0;
			for(int k=0; k<3; k++) tmp += go(x[k], y[k], i, j);
			if(mn==tmp) {
				for(int k=0; k<3; k++) disp(x[k], y[k], i, j);
				printf("%d %d\n", i, j);
				return ;
			}
		}
	}
}

int main() {
#ifndef	ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
  do {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  } while (false);
  array<int, 3> x, y;
  array<int, 1005> cor;
  for (int i = 0; i < 3; i++) {
    cin >> x[i] >> y[i];
    cor[x[i]] = y[i];
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  cout << (y[2] - y[0] + 1) + (x[2] - x[0] + 1) - 1 << endl;
  for (int i = x[0]; i < x[1]; i++) {
    cout << i << " " << cor[x[0]] << endl;
  }
  for (int i = y[0]; i <= y[2]; i++) {
    cout << x[1] << " " << i << endl;
  }
  for (int i = x[1] + 1; i <= x[2]; i++) {
    cout << i << " " << cor[x[2]] << endl;
  }
  return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

using i64 = long long;
using f64 = double;
using f80 = long double;
using pii = pair<int, int>;
using pll = pair<i64, i64>;
using ptx = pair<f64, f64>;

const int N = 3e5 + 5;

vector<pii> pts;
set<pii> ant;

int main() {
#ifdef HOME
	freopen("cf.in", "r", stdin);
	freopen("cf.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int dx, dy;

	pts.resize(3);
	for (auto &i: pts)
		cin >> i.x >> i.y;

	sort(begin(pts), end(pts), [&](pii a, pii b) {
		return a.x < b.x; });
	dx = pts[1].x;
	sort(begin(pts), end(pts), [&](pii a, pii b) {
		return a.y < b.y; });
	dy = pts[1].y;

	for (int p = 0; p < 3; ++p) {
		for (int i = pts[p].x; i <= dx; ++i)
			ant.emplace(i, pts[p].y);
		for (int i = pts[p].x; i >= dx; --i)
			ant.emplace(i, pts[p].y);
		for (int j = pts[p].y; j <= dy; ++j)
			ant.emplace(dx, j);
		for (int j = pts[p].y; j >= dy; --j)
			ant.emplace(dx, j); }

	cout << ant.size() << '\n';
	for (auto i: ant)
		cout << i.x << ' ' << i.y << '\n';

	return 0; }


#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

using i64 = long long;
using f64 = double;
using f80 = long double;
using pii = pair<int, int>;
using pll = pair<i64, i64>;
using ptx = pair<f64, f64>;

const int N = 3e5 + 5;

vector<pii> pts;
set<pii> ant;

int main() {
#ifdef HOME
	freopen("cf.in", "r", stdin);
	freopen("cf.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int dx, dy;

	pts.resize(3);
	for (auto &i: pts)
		cin >> i.x >> i.y;

	sort(begin(pts), end(pts), [&](pii a, pii b) {
		return a.x < b.x; });
	dx = pts[1].x;
	sort(begin(pts), end(pts), [&](pii a, pii b) {
		return a.y < b.y; });
	dy = pts[1].y;

	for (int p = 0; p < 3; ++p) {
		for (int i = pts[p].x; i <= dx; ++i)
			ant.emplace(i, pts[p].y);
		for (int i = pts[p].x; i >= dx; --i)
			ant.emplace(i, pts[p].y);
		for (int j = pts[p].y; j <= dy; ++j)
			ant.emplace(dx, j);
		for (int j = pts[p].y; j <= dy; ++j)
			ant.emplace(dx, j); }

	cout << ant.size() << '\n';
	for (auto i: ant)
		cout << i.x << ' ' << i.y << '\n';

	return 0; }


#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
int main() {
	int a,b;
	vii v,re;
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	sort(v.begin(),v.end());
	ii A = v[0],B = v[1],C = v[2];
	int x=A.first,y=A.second;
	re.push_back(mp(x,y));
	if(C.second > A.second) {
		int dy = max(min(B.second,C.second),A.second);
		for(int i=A.second+1;i<=dy;i++) {
			re.push_back(mp(x,i));
		}
		y += dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y+1;i<=C.second;i++) {
			re.push_back(mp(x,i));
		}
	} else {
		int dy = min(max(B.second,C.second),A.second);
		for(int i=A.second-1;i>=dy;i--) {
			re.push_back(mp(x,i));
		}
		y = dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y-1;i>=C.second;i--) {
			re.push_back(mp(x,i));
		}
	}
	if(B.second > y) {
		for(int i=y+1;i<=B.second;i++) {
			re.push_back(mp(B.first,i));
		}
	} else {
		for(int i=y-1;i>=B.second;i--) {
			re.push_back(mp(B.first,i));
		}
	}
	printf("%d\n",re.size());
	for(int i=0;i<re.size();i++) {
		printf("%d %d\n",re[i].first,re[i].second);
	}
}


#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
int main() {
	int a,b;
	vii v,re;
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	sort(v.begin(),v.end());
	ii A = v[0],B = v[1],C = v[2];
	int x=A.first,y=A.second;
	re.push_back(mp(x,y));
	if(C.second > A.second) {
		int dy = max(min(B.second,C.second),A.second)-A.second;
		for(int i=1;i<=dy;i++) {
			re.push_back(mp(x,y+i));
		}
		y += dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y+1;i<=C.second;i++) {
			re.push_back(mp(x,i));
		}
	} else {
		int dy = min(max(B.second,C.second),A.second);
		for(int i=A.first-1;i>=dy;i--) {
			re.push_back(mp(x,i));
		}
		y = dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y-1;i>=C.second;i--) {
			re.push_back(mp(x,i));
		}
	}
	if(B.second > y) {
		for(int i=y+1;i<=B.second;i++) {
			re.push_back(mp(B.first,i));
		}
	} else {
		for(int i=y-1;i>=B.second;i--) {
			re.push_back(mp(B.first,i));
		}
	}
	printf("%d\n",re.size());
	for(int i=0;i<re.size();i++) {
		printf("%d %d\n",re[i].first,re[i].second);
	}
}


#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
int main() {
	int a,b;
	vii v,re;
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	scanf("%d %d ",&a,&b);
	v.push_back(mp(a,b));
	sort(v.begin(),v.end());
	ii A = v[0],B = v[1],C = v[2];
	int x=A.first,y=A.second;
	re.push_back(mp(x,y));
	if(C.second > A.second) {
		int dy = max(min(B.second,C.second),A.second);
		for(int i=A.second+1;i<=dy;i++) {
			re.push_back(mp(x,i));
		}
		y = dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y+1;i<=C.second;i++) {
			re.push_back(mp(x,i));
		}
	} else {
		int dy = min(max(B.second,C.second),A.second);
		for(int i=A.second-1;i>=dy;i--) {
			re.push_back(mp(x,i));
		}
		y = dy;
		for(int i=A.first+1;i<=C.first;i++) {
			re.push_back(mp(i,y));
		}
		x = C.first;
		for(int i=y-1;i>=C.second;i--) {
			re.push_back(mp(x,i));
		}
	}
	if(B.second > y) {
		for(int i=y+1;i<=B.second;i++) {
			re.push_back(mp(B.first,i));
		}
	} else {
		for(int i=y-1;i>=B.second;i--) {
			re.push_back(mp(B.first,i));
		}
	}
	printf("%d\n",re.size());
	for(int i=0;i<re.size();i++) {
		printf("%d %d\n",re[i].first,re[i].second);
	}
}


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

const int MAXN = 100005;
struct Po {
	int x, y;
	bool operator<(const Po &b) const {
		return x == b.x ? y < b.y : x < b.x;
	}
} p[3];
set<Po> ans;
void print1(Po a, Po b) {
	for (int i = min(a.x, b.x); i <= a.x || i <= b.x; i++)
		ans.insert((Po) { i, a.y });
	for (int i = min(a.y, b.y); i <= a.y || i <= b.y; i++)
		ans.insert((Po) { b.x, i });
}
void print2(Po a, Po b) {
	for (int i = min(a.y, b.y); i <= a.y || i <= b.y; i++)
		ans.insert((Po) { a.x, i });
	for (int i = min(a.x, b.x); i <= a.x || i <= b.x; i++)
		ans.insert((Po) { i, b.y });
}
int main() {
	for (int i = 0; i < 3; i++)
		scanf("%d%d", &p[i].x, &p[i].y);
	sort(p, p + 3);
	if ((p[0].y <= p[1].y && p[1].y <= p[2].y) || (p[0].y >= p[1].y && p[1].y >= p[2].y))
		print1(p[0], p[1]), print1(p[1], p[2]);
	else if (p[1].y >= p[0].y)
		print2(p[0], p[2]), print1(p[1], (Po) { p[1].x, p[0].y });
	else print1(p[0], p[2]), print1(p[1], (Po) { p[1].x, p[0].y });
	printf("%d\n", (int)ans.size());
	for (Po p : ans) printf("%d %d\n", p.x, p.y);
	return 0;
}


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

const int MAXN = 100005;
struct Po {
	int x, y;
	bool operator<(const Po &b) const {
		return x == b.x ? y < b.y : x < b.x;
	}
} p[3];
set<Po> ans;
void print1(Po a, Po b) {
	if (a.y > b.y) swap(a, b);
	for (int i = min(a.x, b.x); i <= a.x || i <= b.x; i++)
		ans.insert((Po) { i, b.y });
	for (int i = a.y; i <= b.y; i++)
		ans.insert((Po) { a.x, i });
}
void print2(Po a, Po b) {
	if (a.y > b.y) swap(a, b);
	for (int i = a.y; i <= b.y; i++)
		ans.insert((Po) { b.x, i });
	for (int i = min(a.x, b.x); i <= a.x || i <= b.x; i++)
		ans.insert((Po) { i, a.y });
}
int main() {
	for (int i = 0; i < 3; i++)
		scanf("%d%d", &p[i].x, &p[i].y);
	sort(p, p + 3);
	if ((p[0].y <= p[1].y && p[1].y <= p[2].y) || (p[0].y >= p[1].y && p[1].y >= p[2].y))
		print1(p[0], p[1]), print1(p[1], p[2]);
	else if (p[1].y >= p[0].y)
		print1(p[0], p[2]), print1(p[1], (Po) { p[1].x, max(p[2].y, p[0].y) });
	else print2(p[0], p[2]), print1(p[1], (Po) { p[1].x, min(p[0].y, p[2].y) });
	printf("%d\n", (int)ans.size());
	for (Po p : ans) printf("%d %d\n", p.x, p.y);
	return 0;
}


#include <bits/stdc++.h>
#define pii pair<ll, ll>
#define mp make_pair
#define F first
#define S second
#define PB push_back
#define FOR(i, u, v) for (int i = u; i <= v; i++)
#define FORD(i, v, u) for (int i = v; i >= u; i--)
#define maxc 1000000007
#define N 100005

using namespace std;

struct Point
{
    int x, y;
}A, B, C, D, res;

void getIn(Point &p)
{
    cin >> p.x >> p.y;
}
int dd[1002][1002];

int dist(Point p, Point q)
{
    return abs(p.x - q.x) + abs(p.y - q.y);
}
int dis(Point p)
{
    return dist(p, A) + dist(p, B) + dist(p, C);
}
void calc(Point p, Point q)
{
    FOR(i, min(p.x, q.x), max(p.x, q.x))
        dd[i][p.y] = 1;
    FOR(i, min(p.y, q.y), max(p.y, q.y))
        dd[q.y][i] = 1;
}
void solve()
{
    calc(res, A);
    calc(res, B);
    calc(res, C);
}
void inkq()
{
    int ans = 0;
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
            ans += dd[i][j];
    cout <<ans<<'\n';
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
            if (dd[i][j]) cout <<i<<' '<<j<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("INP.TXT", "r", stdin);
    getIn(A);
    getIn(B);
    getIn(C);
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
        {
            D = {i, j};
            if (dis(D) < dis(res))
                res = D;
        }
    solve();
    inkq();
}


#include <bits/stdc++.h>
#define pii pair<ll, ll>
#define mp make_pair
#define F first
#define S second
#define PB push_back
#define FOR(i, u, v) for (int i = u; i <= v; i++)
#define FORD(i, v, u) for (int i = v; i >= u; i--)
#define maxc 1000000007
#define N 100005

using namespace std;

struct Point
{
    int x, y;
}A, B, C, D, res;

void getIn(Point &p)
{
    cin >> p.x >> p.y;
}
int dd[1002][1002];

int dist(Point p, Point q)
{
    return abs(p.x - q.x) + abs(p.y - q.y);
}
int dis(Point p)
{
    return dist(p, A) + dist(p, B) + dist(p, C);
}
void calc(Point p, Point q)
{
    FOR(i, min(p.x, q.x), max(p.x, q.x))
        dd[i][p.y] = 1;
    FOR(i, min(p.y, q.y), max(p.y, q.y))
        dd[q.x][i] = 1;
}
void solve()
{
    calc(res, A);
    calc(res, B);
    calc(res, C);
}
void inkq()
{
    int ans = 0;
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
            ans += dd[i][j];
    cout <<ans<<'\n';
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
            if (dd[i][j]) cout <<i<<' '<<j<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("INP.TXT", "r", stdin);
    getIn(A);
    getIn(B);
    getIn(C);
    FOR(i, 0, 1000)
        FOR(j, 0, 1000)
        {
            D = {i, j};
            if (dis(D) < dis(res))
                res = D;
        }
    solve();
    inkq();
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define db double
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 1000;
P a[MAXN];

int main(){
	FOR(i,1,3) scanf("%d%d",&a[i].fi,&a[i].se);
	std::sort(a+1,a+3+1);
	int mx = a[1].se,mn = a[1].se,sm = a[1].se;
	FOR(i,2,3) mx = std::max(mx,a[i].se),mn = std::min(mn,a[i].se),sm += a[i].se;
	int y = sm-mx-mn;
	std::vector<P> ans;
	FOR(i,a[1].fi,a[3].fi) ans.pb(MP(i,y));
	FOR(i,1,3){
		if(a[i].se == y) continue;
		if(a[i].se > y){
			FOR(j,y+1,a[i].se) ans.pb(MP(a[i].fi,j));
		}
		else{
			FOR(j,a[i].se,y-1) ans.pb(MP(a[i].fi,j));
		}
	}
	std::sort(all(ans));ans.erase(std::unique(all(ans)),ans.end());
	printf("%d\n",(int)ans.size());
	for(auto x:ans) printf("%d %d\n",x.fi,x.se);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long

int b[1001][1001];
int v[5],vv[5];
int x[10],y[10];
int ans;
struct pt{
	int x,y;
}p[10];
void drawx(int x1, int x2, int y, int up){
	if (x1>x2) swap(x1,x2);
	for(int i=x1; i<=x2; i++)
		b[i][y]+=up;
}

void drawy(int y1, int y2, int x, int up){
	if (y1>y2) swap(y1,y2);
	for(int i=y1; i<=y2; i++)
		b[x][i]+=up;
}

int calc(){
	int now=0;
	for(int i=0;i<=1000;i++)
		for(int j=0;j<=1000;j++)
			now+=(b[i][j]>0);
	return now;
}
bool cmpx(const pt &a, const pt &b){
	return a.x<b.x;
}

void dfs(int step){
	if (step==2){
		int tmp =calc();
		if (tmp < ans){
			ans = tmp;
			for(int i=0; i<3; i++)
				vv[i] = v[i];
		}
		return;
	}

	int x1, x2, y1, y2;
	x1 = x[step];
	y1 = y[step];
	x2 = x[step+1];
	y2 = y[step+1];

	v[step] = 0;

	drawx(x1, x2, y1, 1);
	drawy(y1, y2, x2, 1);

	dfs(step+1);

	drawx(x1, x2, y1, -1);
	drawy(y1, y2, x2, -1);

	v[step] = 1;

	drawy(y1, y2, x1, 1);
	drawx(x1, x2, y2, 1);

	dfs(step+1);

	drawy(y1, y2, x1, -1);
	drawx(x1, x2, y2, -1);
}
int main(){
	scanf("%d %d",&p[0].x, &p[0].y);
	scanf("%d %d",&p[1].x, &p[1].y);
	scanf("%d %d",&p[2].x, &p[2].y);
	sort(p, p+3, cmpx);

	for(int i=0; i<=2; i++)
		x[i]=p[i].x, y[i]=p[i].y;

	ans = 1001*1001;
	dfs(0);
	printf("%d\n",ans);
	for(int i=0;i<2;i++)
		if (!vv[i]){
			drawx(x[i], x[i+1], y[i], 1);
			drawy(y[i], y[i+1], x[i+1], 1);
		}else{
			drawy(y[i], y[i+1], x[i], 1);
			drawx(x[i], x[i+1], y[i+1], 1);
		}
	for(int i=0;i<=1000;i++)
		for(int j=0;j<=1000;j++)
			if (b[i][j]>0)
				printf("%d %d\n", i, j);
	return 0;
}


//Solution by Tima
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
#define y1 sda
using namespace std;
const int N = 2000, mod = int(1e9)  + 7;

int x[3],y[3], px, py;

vector <pair<int,int> > fans;
bool used[N][N];

void up(int x,int y){
	if(!used[x][y]){
		fans.pb(mp(x,y));
		used[x][y] = 1;
	}
}

void add(int x,int y,int a,int b){
	up(x,y);
	if(x < a){
		while(x < a){
			x++;
			up(x,y);
		}
	}
	if(x > a){
		while(x > a){
			x--;
			up(x,y);
		}
	}
	if(y < b){
		while(y < b){
			y++;
			up(x,y);
		}
	}
	if(y > b){
		while(y > b){
			y--;
			up(x,y);
		}
	}
}

int main () {
	for(int i = 0; i < 3; i++){
		cin >> x[i] >> y[i];
	}

	int ans = mod;

	for(int i = 0; i <= 1000; i++){
		for(int j = 0; j <= 1000; j++){
			int res = 0;
			for(int k = 0; k < 3; k++){
				res += abs(x[k] - i) + abs(y[k] - i) + 1;
			}
			if(ans > res){
				ans = res;
				px = i, py = j;
			}
		}
	}

	for(int i = 0; i < 3; i++){
		add(px,py,x[i], y[i]);
	}
	cout << fans.size() << endl;
	for(int i = 0; i < fans.size(); i++){
		cout << fans[i].f << " " << fans[i].s << endl;
	}

return 0;
}


//Solution by Tima
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#define f first
#define s second
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
#define y1 sda
using namespace std;
const int N = 2000, mod = int(1e9)  + 7;

int x[3],y[3], px, py;

vector <pair<int,int> > fans;
bool used[N][N];

void up(int x,int y){
	if(!used[x][y]){
		fans.pb(mp(x,y));
		used[x][y] = 1;
	}
}

void add(int x,int y,int a,int b){
	up(x,y);
	if(x < a){
		while(x < a){
			x++;
			up(x,y);
		}
	}
	if(x > a){
		while(x > a){
			x--;
			up(x,y);
		}
	}
	if(y < b){
		while(y < b){
			y++;
			up(x,y);
		}
	}
	if(y > b){
		while(y > b){
			y--;
			up(x,y);
		}
	}
}

int main () {
	for(int i = 0; i < 3; i++){
		cin >> x[i] >> y[i];
	}

	int ans = mod;

	for(int i = 0; i <= 1000; i++){
		for(int j = 0; j <= 1000; j++){
			int res = 0;
			for(int k = 0; k < 3; k++){
				res += abs(x[k] - i) + abs(y[k] - j) + 1;
			}
			if(ans > res){
				ans = res;
				px = i, py = j;
			}
		}
	}

	for(int i = 0; i < 3; i++){
		add(px,py,x[i], y[i]);
	}
	cout << fans.size() << endl;
	for(int i = 0; i < fans.size(); i++){
		cout << fans[i].f << " " << fans[i].s << endl;
	}

return 0;
}


# include <bits/stdc++.h>

# define y1 aasjdladljskdj
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef unsigned long long ull;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int x[4], y[4];
set < pii > s;

void moveto(int f1, int s1, int f2, int s2){
  while(1){
    s.insert(make_pair(f1, s1));
    if(f1 == f2) break;
    f1 += (f1 < f2 ? 1 : -1);
  }
  while(1){
    s.insert(make_pair(f1, s1));
    if(s1 == s2) break;
    s1 += (s1 < s2 ? 1 : -1);
  }
}

int main(){
  for(int i = 1; i <= 3; ++i){
    scanf("%d %d", x + i, y + i);
  }
  pii ans = make_pair(0, 0);
  int dist = inf;
  for(int f = 0; f <= 1000; ++f){
    for(int s = 0; s <= 1000; ++s){
      int cur = 0;
      for(int t = 1; t <= 3; ++t){
        cur += abs(x[t] - f) + abs(y[t] - s);
      }
      if(cur < dist){
        dist = cur;
        ans = make_pair(f, s);
      }
    }
  }
  for(int i = 1; i <= 3; ++i){
    moveto(x[i], y[i], ans.first, ans.second);
  }
  printf("%d\n", sz(s));
  for(auto i : s){
    printf("%d %d\n", i.first, i.second);
  }
  return 0;
}


# include <bits/stdc++.h>

# define y1 aasjdladljskdj
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef unsigned long long ull;

const int N = int(4e5) + 5;
const int inf = (int)1e9 + 7;

pii p[4], p2[4];
int u[1001][1001];
int mn = inf;
vector < pii > f;

void go(pii x, pii y){
  while(true){
    u[x.first][x.second] = 1;
    if(x == y) break;
    if(x.first < y.first){
      ++x.first;
      continue;
    }
    if(x.first > y.first){
      --x.first;
      continue;
    }
    if(x.second < y.second){
      ++x.second;
      continue;
    }
    if(x.second > y.second){
      --x.second;
      continue;
    }
  }
}

void calc(){

  for(int i = 0; i <= 1000; ++i){
    for(int j = 0; j <= 1000; ++j){
      u[i][j] = 0;
    }
  }
  go(p[1], p[2]);
  go(p[2], p[3]);
  vector < pii > cur;
  for(int i = 0; i <= 1000; ++i){
    for(int j = 0; j <= 1000; ++j){
      if(u[i][j]){
        cur.push_back(make_pair(i, j));
      }
    }
  }
  if(sz(cur) < mn){
    mn = sz(cur);
    f = cur;
  }
}

int main(){
  for(int i = 1; i <= 3; ++i){
    scanf("%d %d", &p[i].first, &p[i].second);
    p2[i] = p[i];
  }
  vector < int > pp = {1, 2, 3};
  do{
    for(int i = 0; i < 3; ++i){
      p[i + 1] = p2[pp[i]];
    }
    calc();
  } while(next_permutation(pp.begin(), pp.end()));
  printf("%d\n", sz(f));
  for(auto i : f){
    printf("%d %d\n", i.first, i.second);
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
#define mp make_pair

int getmidof(vi tmp)
{
    sort(tmp.begin(), tmp.end());
    return tmp[1]; // 0, 1, 2
                  // 1 is the mid
}

int main()
{
    vi x(3), y(3);

    for(int i = 0; i < 3; i++) cin >> x[i] >> y[i];

    set<pair<int, int>> ans;
    int midx = getmidof(x), midy = getmidof(y);

    for(int i = 0; i < 3; i++){
        int tx = x[i], ty = y[i];

        while(midx != tx){

            ans.insert(mp(tx, ty));
            if(tx > midx) tx -= 1;
            else tx += 1;
        }
        while(midy != ty){

            ans.insert(mp(tx, ty));
            if(ty > midy) ty -= 1;
            else ty += 1;
        }
    }
    ans.insert(mp(midx, midy));

    cout << ans.size() << "\n";
    for(auto x: ans) cout << x.first << ' ' << x.second << '\n';

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
#define mp make_pair

int getmidof(vi tmp)
{
    sort(tmp.begin(), tmp.end());
    return tmp[1]; // 0, 1, 2
                  // 1 is the mid
}

int main()
{
    vi x(3), y(3);

    for(int i = 0; i < 3; i++) cin >> x[i] >> y[i];

    set<pair<int, int>> ans;
    //int midx = getmidof(x), midy = getmidof(y);
    int midx = x[0] > x[1] ? (x[0] < x[2] ? x[0] : (x[1] < x[2]? x[1] : x[2]) ) : ( x[0] > x[2] ? x[0] : (x[1] > x[2] ? x[2] : x[1]) );
    int midy = y[0] > y[1] ? (y[0] < y[2] ? y[0] : (y[1] < y[2]? y[1] : y[2]) ) : ( y[0] > y[2] ? y[0] : (y[1] > y[2] ? y[2] : y[1]) );

    for(int i = 0; i < 3; i++){
        int tx = x[i], ty = y[i];

        while(midx != tx){

            ans.insert(mp(tx, ty));
            if(tx > midx) tx -= 1;
            else tx += 1;
        }
        while(midy != ty){

            ans.insert(mp(tx, ty));
            if(ty > midy) ty -= 1;
            else ty += 1;
        }
    }
    ans.insert(mp(midx, midy));

    cout << ans.size() << "\n";
    for(auto x: ans) cout << x.first << ' ' << x.second << '\n';

    return 0;
}


#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define PI acos(-1.0)
#define pb push_back
#define mp make_pair
#define LL long long
#define pil pair<int,LL>
#define pii pair<int,int>
#define pic pair<int,char>
using namespace std;
const int maxn = 1e5 + 5;

pii pos[5];
queue<pii>tt;

int main(){
	for(int i = 0; i < 3; i++) {
		cin >> pos[i].fi >> pos[i].se;
	}
	sort(pos,pos + 3);
	if(pos[1].se >= pos[0].se && pos[1].se <= pos[2].se){
		int deep = min(pos[0].se, pos[2].se), top = max(pos[0].se, pos[2].se);
		for(int i = pos[0].fi; i < pos[1].fi; i++) {
			tt.push(mp(i, pos[0].se) );
		}
		for(int i = deep; i <= top; i++) {
			tt.push(mp(pos[1].fi, i) );
		}
		for(int i = pos[1].fi + 1; i <= pos[2].fi; i++) {
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	else{
		int deep = min(pos[0].se, pos[2].se), top = max(pos[0].se, pos[2].se);
		for(int i = pos[0].fi; i < pos[1].fi; i++) {
			tt.push(mp(i, pos[0].se) );
		}
		if(pos[1].se > top){
			for(int i = pos[1].se; i >= deep; i--) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		else{
			for(int i = pos[1].se; i <= top; i++) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		for(int i = pos[1].fi + 1; i <= pos[2].fi; i++) {
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	return 0;
}


#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define PI acos(-1.0)
#define pb push_back
#define mp make_pair
#define LL long long
#define pil pair<int,LL>
#define pii pair<int,int>
#define pic pair<int,char>
using namespace std;
const int maxn = 1e5 + 5;

pii pos[5];
queue<pii>tt;

int main(){
	for(int i = 0; i < 3; i++) {
		cin >> pos[i].fi >> pos[i].se;
	}
	sort(pos,pos + 3);
	int deep = min(pos[0].se, pos[2].se), top = max(pos[0].se, pos[2].se);
	if(pos[1].se >= deep && pos[1].se <= top){
		for(int i = pos[0].fi; i < pos[1].fi; i++) {
		//	cout << i << " " << pos[0].se << endl;
			tt.push(mp(i, pos[0].se) );
		}
		for(int i = deep; i <= top; i++) {
		//	cout << pos[1].fi << " " << i << endl;
			tt.push(mp(pos[1].fi, i) );
		}
		for(int i = pos[1].fi + 1; i <= pos[2].fi; i++) {
		//	cout << i << " " << pos[2].se << endl;
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	else{
		for(int i = pos[0].fi; i < pos[1].fi; i++) {
			tt.push(mp(i, pos[0].se) );
		}
		if(pos[1].se > top){
			for(int i = pos[1].se; i >= deep; i--) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		else{
			for(int i = pos[1].se; i <= top; i++) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		for(int i = pos[1].fi + 1; i <= pos[2].fi; i++) {
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	return 0;
}


#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fi first
#define se second
#define PI acos(-1.0)
#define pb push_back
#define mp make_pair
#define LL long long
#define pil pair<int,LL>
#define pii pair<int,int>
#define pic pair<int,char>
using namespace std;
const int maxn = 1e5 + 5;

pii pos[5];
queue<pii>tt;

int main(){
	for(int i = 0; i < 3; i++) {
		cin >> pos[i].fi >> pos[i].se;
	}
	sort(pos,pos + 3);
	int deep = min(pos[0].se, pos[2].se), top = max(pos[0].se, pos[2].se);
	if(pos[1].se >= deep && pos[1].se <= top){
		for(int i = pos[0].fi; i <= pos[1].fi; i++) {
		//	cout << i << " " << pos[0].se << endl;
			tt.push(mp(i, pos[0].se) );
		}
		for(int i = deep + 1; i < top; i++) {
		//	cout << pos[1].fi << " " << i << endl;
			tt.push(mp(pos[1].fi, i) );
		}
		for(int i = pos[1].fi; i <= pos[2].fi; i++) {
		//	cout << i << " " << pos[2].se << endl;
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	else{
		for(int i = pos[0].fi; i < pos[1].fi; i++) {
			tt.push(mp(i, pos[0].se) );
		}
		if(pos[1].se > top){
			for(int i = pos[1].se; i >= deep; i--) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		else{
			for(int i = pos[1].se; i <= top; i++) {
				tt.push(mp(pos[1].fi, i) );
			}
		}
		for(int i = pos[1].fi + 1; i <= pos[2].fi; i++) {
			tt.push(mp(i, pos[2].se) );
		}
		cout << tt.size() << endl;
		while(!tt.empty()){
			pii tot = tt.front();  tt.pop();
			cout << tot.fi << " " << tot.se << endl;
		}
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <iostream>

#define fo(i, x, y) for (int i = (x); i <= (y); ++i)
#define fd(i, x, y) for (int i = (x); i >= (y); --i)
using namespace std;

const int inf = 1e9;

struct Point {int x, y;} p[4];
int l = inf, r = -inf, u = -inf, d = inf;

int getint() {
	char ch;
	int res = 0, p;
	while (!isdigit(ch = getchar()) && (ch ^ '-'));
	p = ch == '-'? ch = getchar(), -1 : 1;
	while (isdigit(ch))
		res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
	return res * p;
}

inline bool cmp(const Point &a, const Point &b) {
	return a.y < b.y;
}

int main() {
	fo (i, 1, 3) {
		p[i].x = getint(), p[i].y = getint();
		l = min(l, p[i].x); r = max(r, p[i].x);
		d = min(d, p[i].y); u = max(u, p[i].y);
	}
	sort(p + 1, p + 1 + 3, cmp);
	printf("%d\n", u - d + 1 + r - l);
	fo (i, l, r) printf("%d %d\n", i, p[2].y);
	fd (i, u, p[2].y + 1) printf("%d %d\n", p[3].x, i);
	fd (i, p[2].y - 1, d) printf("%d %d\n", p[1].x, i);
	return 0;
}


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

#define mp              make_pair
#define pb              push_back
#define ff              first
#define ss              second
#define inc(A,B)        A=(A+(B))%MOD
#define mul(A,B)        (ll(A)*ll(B)%ll(MOD))
#define sub(a,b)        (((a)-(b)+MOD)%MOD)

typedef long long ll;
typedef pair < ll ,ll > pll;
typedef complex < ll > pt;

const int MAX_N = 5;
const int MOD = 1e9 + 7;

int arrX[MAX_N], arrY[MAX_N];

int calc ( int x, int y ) {
  int ans = 0;
  for ( int i = 0; i < 3; ++i )
    ans += abs ( x-arrX[i] ) + abs ( y-arrY[i] );
  return ans + 1;
}

int sign ( int num ) {
  if ( !num ) return num;
  return num / abs ( num );
}

void printFor ( int ind, int rX, int rY ) {
  if ( rX == arrX[ind] and rY == arrY[ind] )
    return;
  while ( rX != arrX[ind] ) {
    rX += sign ( arrX[ind]-rX );
    printf ( "%d %d\n", rX, rY );
  }
  while ( rY != arrY[ind] ) {
    rY += sign ( arrY[ind]-rY );
    printf ( "%d %d\n", rX, rY );
  }
}

int main() {

//  freopen ( "in.txt" , "r" , stdin );
//  freopen ( "out.txt" , "w" , stdout );

  for ( int i = 0; i < 3; ++i )
    scanf ( "%d%d", arrX+i, arrY+i );

  int mini = INT_MAX;
  int resX, resY;

  for ( int i = 0; i <= 1000; ++i ) {
    for ( int h = 0; h <= 1000; ++h ) {
      int aux = calc ( i, h );
      if ( mini > aux )
        mini = aux, resX = i, resY = h;
    }
  }

  printf ( "%d\n", mini );
  for ( int i = 0; i < 3; ++i )
    printFor ( i, resX, resY );
  printf ( "%d %d\n", resX, resY );

  return 0;

}


#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

struct point
{
	int y, x;
};
int n;
point A, B, C;
vector<point> path;

void add(point a, point b){
	if(a.x > b.x) swap(a, b);
	if(a.y == b.y){
		for(int i = a.x + 1; i < b.x; i++){
			point p = {a.y, i};
			path.pb(p);
		}
		return;
	}
	if(a.x == b.x){
		if(a.y > b.y) swap(a, b);
		for(int i = a.y + 1; i < b.y; i++){
			point p = {i, a.x};
			path.pb(p);
		}
		return;
	}
	for(int i = a.x + 1; i <= b.x; i++){
		point p = {a.y, i};
		path.pb(p);
	}
	int t = 1;
	if(a.y > b.y) t = -1;
	for(int i = a.y + t; i != b.y; i += t){
		point p = {i, b.x};
		path.pb(p);
	}
}

void pri(){
	cout << path.size() + 3 << endl;
	for(auto p : path){
		cout << p.x << " " << p.y << endl;
	}
	cout << A.x << " " << A.y << endl;
	cout << B.x << " " << B.y << endl;
	cout << C.x << " " << C.y << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
    if(A.x == B.x and B.x == C.x){
    	if(A.y > B.y) swap(A, B);
    	if(A.y > C.y) swap(A, C);
    	if(B.y > C.y) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;
    }
    if(A.y == B.y and B.y == C.y){
    	if(A.x > B.x) swap(A, B);
    	if(A.x > C.x) swap(A, C);
    	if(B.x > C.x) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;

    }
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    swap(B, C);
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }

    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    swap(B, C);
    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    add(A, B);
    add(C, B);
    pri();
}


#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

struct point
{
	int y, x;
};
int n;
point A, B, C;
vector<point> path;

void add(point a, point b){
	if(a.x > b.x) swap(a, b);
	for(int i = a.x + 1; i < b.x; i++){
		point p = {a.y, i};
		path.pb(p);
	}
	int t = 1;
	if(a.y > b.y) t = -1;
	if(a.y == b.y) return;
	for(int i = a.y + t; i != b.y; i += t){
		point p = {i, b.x};
		path.pb(p);
	}
}

void pri(){
	cout << path.size() + 3 << endl;
	for(auto p : path){
		cout << p.x << " " << p.y << endl;
	}
	cout << A.x << " " << A.y << endl;
	cout << B.x << " " << B.y << endl;
	cout << C.x << " " << C.y << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
    if(A.x == B.x and B.x == C.x){
    	if(A.y > B.y) swap(A, B);
    	if(A.y > C.y) swap(A, C);
    	if(B.y > C.y) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;
    }
    if(A.y == B.y and B.y == C.y){
    	if(A.x > B.x) swap(A, B);
    	if(A.x > C.x) swap(A, C);
    	if(B.x > C.x) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;

    }
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.x == B.x){
    	add(A, B);
    	point p = {A.x, min(A.y, B.y)};
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = max(A.y, B.y);
    	add(p, C);
    	pri();
    	return 0;
    }

    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.y == B.y){
    	add(A, B);
    	point p = {min(A.x, B.x), A.y};
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = max(A.x, B.x);
    	add(p, C);
    	pri();
    	return 0;
    }
    add(A, B);
    add(C, B);
    pri();
}


#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

struct point
{
	int y, x;
    bool eq(point p){
        return y == p.y and x == p.x;
    }

    int dist(point p){
        return abs(p.y - y) + abs(p.x - x);
    }
};
int n;
point A, B, C;
vector<point> path;

void add(point a, point b){
	if(a.x > b.x) swap(a, b);
	if(a.y == b.y){
		for(int i = a.x + 1; i < b.x; i++){
			point p = {a.y, i};
			path.pb(p);
		}
		return;
	}
	if(a.x == b.x){
		if(a.y > b.y) swap(a, b);
		for(int i = a.y + 1; i < b.y; i++){
			point p = {i, a.x};
			path.pb(p);
		}
		return;
	}
	for(int i = a.x + 1; i <= b.x; i++){
		point p = {a.y, i};
		path.pb(p);
	}
	int t = 1;
	if(a.y > b.y) t = -1;
	for(int i = a.y + t; i != b.y; i += t){
		point p = {i, b.x};
		path.pb(p);
	}
}

void pri(){
	cout << path.size() + 3 << endl;
	for(auto p : path){
		cout << p.x << " " << p.y << endl;
	}
	cout << A.x << " " << A.y << endl;
	cout << B.x << " " << B.y << endl;
	cout << C.x << " " << C.y << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
    int bDist = MAXN;
    point best;
    for(int i = 0; i <= 1000; i++){
        for(int j = 0; j <= 1000; j++){
            point p = {i, j};
            int d = p.dist(A) + p.dist(B) + p.dist(C);
            if(d < bDist){
                bDist = d;
                best = p;
            }
        }
    }

    add(A, best);
    add(B, best);
    add(C, best);
    if(!best.eq(A) and !best.eq(B)and !best.eq(C))
        path.pb(best);
    pri();
}


#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

struct point
{
	int y, x;
};
int n;
point A, B, C;
vector<point> path;

void add(point a, point b){
	if(a.x > b.x) swap(a, b);
	for(int i = a.x + 1; i < b.x; i++){
		point p = {a.y, i};
		path.pb(p);
	}
	int t = 1;
	if(a.y > b.y) t = -1;
	if(a.y == b.y) return;
	for(int i = a.y + t; i != b.y; i += t){
		point p = {i, b.x};
		path.pb(p);
	}
}

void pri(){
	cout << path.size() + 3 << endl;
	for(auto p : path){
		cout << p.x << " " << p.y << endl;
	}
	cout << A.x << " " << A.y << endl;
	cout << B.x << " " << B.y << endl;
	cout << C.x << " " << C.y << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
    if(A.x == B.x and B.x == C.x){
    	if(A.y > B.y) swap(A, B);
    	if(A.y > C.y) swap(A, C);
    	if(B.y > C.y) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;
    }
    if(A.y == B.y and B.y == C.y){
    	if(A.x > B.x) swap(A, B);
    	if(A.x > C.x) swap(A, C);
    	if(B.x > C.x) swap(C, B);
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;

    }
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }

    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    add(A, B);
    add(C, B);
    pri();
}


#include <bits/stdc++.h>
#define MAXN 100100
#define pii pair<int, int>
#define pb push_back
typedef long long ll;

using namespace std;

struct point
{
	int y, x;
};
int n;
point A, B, C;
vector<point> path;

void add(point a, point b){
	if(a.x > b.x) swap(a, b);
	for(int i = a.x + 1; i < b.x; i++){
		point p = {a.y, i};
		path.pb(p);
	}
	int t = 1;
	if(a.y > b.y) t = -1;
	if(a.y == b.y) return;
	for(int i = a.y + t; i != b.y; i += t){
		point p = {i, b.x};
		path.pb(p);
	}
}

void pri(){
	cout << path.size() + 3 << endl;
	for(auto p : path){
		cout << p.x << " " << p.y << endl;
	}
	cout << A.x << " " << A.y << endl;
	cout << B.x << " " << B.y << endl;
	cout << C.x << " " << C.y << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
    if(A.x == B.x and B.x == C.x or A.y == B.y and B.y == C.y){
    	add(A, B);
    	add(C, B);
    	pri();
    	return 0;
    }
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.x == B.x){
    	add(A, B);
    	point p = A;
    	if(C.x >= min(A.x, B.x) and C.x <= max(A.x, B.x)) p.x = C.x;
    	if(C.x > max(A.x, B.x)) p.x = B.x;
    	add(p, C);
    	pri();
    	return 0;
    }

    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, C);
    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    swap(A, B);
    if(A.y == B.y){
    	add(A, B);
    	point p = A;
    	if(C.y >= min(A.y, B.y) and C.y <= max(A.y, B.y)) p.y = C.y;
    	if(C.y > max(A.y, B.y)) p.y = B.y;
    	add(p, C);
    	pri();
    	return 0;
    }
    add(A, B);
    add(C, B);
    pri();
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int x[3], y[3];
vector<int> xs, ys;
bool hv[3][3];
bool drw[1005][1005];

struct dsu
{
	int prev[15];
	void init()
	{
		rep(i, 15) prev[i] = i;
	}
	int root(int x)
	{
		return x == prev[x] ? x : prev[x] = root(prev[x]);
	}
	bool unite(int u, int v)
	{
		u = root(u);
		v = root(v);
		if(u == v) return false;
		prev[u] = v;
		return true;
	}
}con;

int absv(int x)
{
	return x < 0 ? -x : x;
}

vector<pair<int, pair<PII, PII> > > edg;
int mst_siz()
{
	edg.clear();
	rep(i0, xs.size()) rep(j0, ys.size())
	rep(i1, xs.size()) rep(j1, ys.size())
	if(hv[i0][j0] && hv[i1][j1]) edg.push_back(MP(absv(xs[i0] - xs[i1]) + absv(ys[j0] - ys[j1]), MP(MP(i0, j0), MP(i1, j1))));
	sort(edg.begin(), edg.end());

	con.init();
	int ret = 0;
	rep(i, edg.size()) {
		PII u = edg[i].second.first, v = edg[i].second.second;
		if(con.unite(u.first * ys.size() + u.second, v.first * ys.size() + v.second)) ret += edg[i].first;
	}
	return ret;
}

void draw_mst()
{
	edg.clear();
	rep(i0, xs.size()) rep(j0, ys.size())
	rep(i1, xs.size()) rep(j1, ys.size())
	if(hv[i0][j0] && hv[i1][j1]) edg.push_back(MP(absv(xs[i0] - xs[i1]) + absv(ys[j0] - ys[j1]), MP(MP(i0, j0), MP(i1, j1))));
	sort(edg.begin(), edg.end());

	con.init();
	rep(i, edg.size()) {
		PII u = edg[i].second.first, v = edg[i].second.second;
		if(con.unite(u.first * ys.size() + u.second, v.first * ys.size() + v.second)) {
			for(int j = u.first; j != v.first; j += (u.first > v.first ? -1 : 1)) drw[j][u.second] = true;
			for(int j = u.second; j != v.second; j += (u.second > v.second ? -1 : 1)) drw[v.first][j] = true;
			drw[v.first][v.second] = true;
		}
	}
}

int main()
{
	rep(i, 3) scanf("%d%d", &x[i], &y[i]);
	rep(i, 3) {
		xs.push_back(x[i]);
		ys.push_back(y[i]);
	}
	sort(xs.begin(), xs.end());
	xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
	sort(ys.begin(), ys.end());
	ys.resize(unique(ys.begin(), ys.end()) - ys.begin());

	int ans = INF;
	rep(i, 1 << xs.size() * ys.size()) {
		rep(j, xs.size()) rep(k, ys.size()) hv[j][k] = i >> (j * ys.size() + k) & 1;
		bool ok = true;
		rep(j, 3) if(!hv[lower_bound(xs.begin(), xs.end(), x[j]) - xs.begin()][lower_bound(ys.begin(), ys.end(), y[j]) - ys.begin()]) ok = false;
		if(!ok) continue;

		ans = min(ans, mst_siz());
	}

	printf("%d\n", ans + 1);

	rep(i, 1 << xs.size() * ys.size()) {
		rep(j, xs.size()) rep(k, ys.size()) hv[j][k] = i >> (j * ys.size() + k) & 1;
		bool ok = true;
		rep(j, 3) if(!hv[lower_bound(xs.begin(), xs.end(), x[j]) - xs.begin()][lower_bound(ys.begin(), ys.end(), y[j]) - ys.begin()]) ok = false;
		if(!ok) continue;

		if(mst_siz() == ans) {
			draw_mst();
			break;
		}
	}

	for(int i = 0; i <= 1000; i ++) for(int j = 0; j <= 1000; j ++)
	if(drw[i][j]) printf("%d %d\n", i, j);
	return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int x[3], y[3];
vector<int> xs, ys;
bool hv[3][3];
bool drw[1005][1005];

struct dsu
{
	int prev[15];
	void init()
	{
		rep(i, 15) prev[i] = i;
	}
	int root(int x)
	{
		return x == prev[x] ? x : prev[x] = root(prev[x]);
	}
	bool unite(int u, int v)
	{
		u = root(u);
		v = root(v);
		if(u == v) return false;
		prev[u] = v;
		return true;
	}
}con;

int absv(int x)
{
	return x < 0 ? -x : x;
}

vector<pair<int, pair<PII, PII> > > edg;
int mst_siz()
{
	edg.clear();
	rep(i0, xs.size()) rep(j0, ys.size())
	rep(i1, xs.size()) rep(j1, ys.size())
	if(hv[i0][j0] && hv[i1][j1]) edg.push_back(MP(absv(xs[i0] - xs[i1]) + absv(ys[j0] - ys[j1]), MP(MP(i0, j0), MP(i1, j1))));
	sort(edg.begin(), edg.end());

	con.init();
	int ret = 0;
	rep(i, edg.size()) {
		PII u = edg[i].second.first, v = edg[i].second.second;
		if(con.unite(u.first * ys.size() + u.second, v.first * ys.size() + v.second)) ret += edg[i].first;
	}
	return ret;
}

void draw_mst()
{
	edg.clear();
	rep(i0, xs.size()) rep(j0, ys.size())
	rep(i1, xs.size()) rep(j1, ys.size())
	if(hv[i0][j0] && hv[i1][j1]) edg.push_back(MP(absv(xs[i0] - xs[i1]) + absv(ys[j0] - ys[j1]), MP(MP(i0, j0), MP(i1, j1))));
	sort(edg.begin(), edg.end());

	con.init();
	rep(i, edg.size()) {
		PII u = edg[i].second.first, v = edg[i].second.second;
		if(con.unite(u.first * ys.size() + u.second, v.first * ys.size() + v.second)) {
			u.first = xs[u.first];
			u.second = ys[u.second];
			v.first = xs[v.first];
			v.second = ys[v.second];
			for(int j = u.first; j != v.first; j += (u.first > v.first ? -1 : 1)) drw[j][u.second] = true;
			for(int j = u.second; j != v.second; j += (u.second > v.second ? -1 : 1)) drw[v.first][j] = true;
			drw[v.first][v.second] = true;
		}
	}
}

int main()
{
	rep(i, 3) scanf("%d%d", &x[i], &y[i]);
	rep(i, 3) {
		xs.push_back(x[i]);
		ys.push_back(y[i]);
	}
	sort(xs.begin(), xs.end());
	xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
	sort(ys.begin(), ys.end());
	ys.resize(unique(ys.begin(), ys.end()) - ys.begin());

	int ans = INF;
	rep(i, 1 << xs.size() * ys.size()) {
		rep(j, xs.size()) rep(k, ys.size()) hv[j][k] = i >> (j * ys.size() + k) & 1;
		bool ok = true;
		rep(j, 3) if(!hv[lower_bound(xs.begin(), xs.end(), x[j]) - xs.begin()][lower_bound(ys.begin(), ys.end(), y[j]) - ys.begin()]) ok = false;
		if(!ok) continue;

		ans = min(ans, mst_siz());
	}

	printf("%d\n", ans + 1);

	rep(i, 1 << xs.size() * ys.size()) {
		rep(j, xs.size()) rep(k, ys.size()) hv[j][k] = i >> (j * ys.size() + k) & 1;
		bool ok = true;
		rep(j, 3) if(!hv[lower_bound(xs.begin(), xs.end(), x[j]) - xs.begin()][lower_bound(ys.begin(), ys.end(), y[j]) - ys.begin()]) ok = false;
		if(!ok) continue;

		if(mst_siz() == ans) {
			draw_mst();
			break;
		}
	}

	for(int i = 0; i <= 1000; i ++) for(int j = 0; j <= 1000; j ++)
	if(drw[i][j]) printf("%d %d\n", i, j);
	return 0;
}


#pragma GCC optimize(2)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#define lowbit(n) n & (-n)
#define ls x<<1
#define rs x<<1|1
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; scanf("%d", &T);  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define read(a) scanf("%d", &a)
#define readd(a) scanf("%lf", &a)
#define readl(a) scanf("%lld", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define sqr(x) x*x
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const int mod = 1e9 + 7;
const double eps = 1e-6;
set<PII> s;
PII p[10];
int main()
{
    rep(i, 0, 2)
    {
        read(p[i].x);   read(p[i].y);
    }
    sort(p, p+3);
    for(int x = min(p[0].x, p[1].x); x <= max(p[0].x, p[1].x); x ++)    s.insert({x, p[0].y});
    for(int y = min(p[0].y, p[1].y); y <= max(p[0].y, p[1].y); y ++)    s.insert({p[1].x, y});
    for(int x = min(p[2].x, p[1].x); x <= max(p[2].x, p[1].x); x ++)    s.insert({x, p[1].y});
    for(int y = min(p[2].y, p[1].y); y <= max(p[2].y, p[1].y); y ++)    s.insert({p[2].x, y});
	printf("%d\n", s.size());
	for(auto t : s) printf("%d %d\n", t.x, t.y);
	return 0;
}


#pragma GCC optimize(2)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#define lowbit(n) n & (-n)
#define ls x<<1
#define rs x<<1|1
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; scanf("%d", &T);  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define read(a) scanf("%d", &a)
#define readd(a) scanf("%lf", &a)
#define readl(a) scanf("%lld", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define sqr(x) x*x
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const int mod = 1e9 + 7;
const double eps = 1e-6;
set<PII> s;
PII p[10];
int main()
{
    rep(i, 0, 2)
    {
        read(p[i].x);   read(p[i].y);
    }
    sort(p, p+3);
    PII p0 = {2000, 2000};
    for(int x = min(p[0].x, p[1].x); x <= max(p[0].x, p[1].x); x ++)
        {
            s.insert({x, p[0].y});
            if(abs(x-p[2].x) + abs(p[0].y-p[2].y) <= abs(p[2].x-p0.x)+abs(p[2].y-p0.y)) p0 = {x, p[0].y};
        }
    for(int y = min(p[0].y, p[1].y); y <= max(p[0].y, p[1].y); y ++)
    {
        s.insert({p[1].x, y});
        if(abs(p[1].x-p[2].x) + abs(y-p[2].y) <= abs(p[2].x-p0.x)+abs(p[2].y-p0.y)) p0 = {p[1].x, y};
    }
    for(int x = min(p0.x, p[2].x); x <= max(p0.x, p[2].x); x ++)
            s.insert({x, p0.y});
    for(int y = min(p0.y, p[2].y); y <= max(p0.y, p[2].y); y ++)
        s.insert({p[2].x, y});
	printf("%d\n", s.size());
	for(auto t : s) printf("%d %d\n", t.x, t.y);
	return 0;
}


#pragma GCC optimize(2)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#define lowbit(n) n & (-n)
#define ls x<<1
#define rs x<<1|1
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; scanf("%d", &T);  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define read(a) scanf("%d", &a)
#define readd(a) scanf("%lf", &a)
#define readl(a) scanf("%lld", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define sqr(x) x*x
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const int mod = 1e9 + 7;
const double eps = 1e-6;
set<PII> s;
PII p[10];
int main()
{
    rep(i, 0, 2)
    {
        read(p[i].x);   read(p[i].y);
    }
    sort(p, p+3);
    for(int x = min(p[0].x, p[1].x); x <= max(p[0].x, p[1].x); x ++)    s.insert({x, p[0].y});
    for(int y = min(p[0].y, p[1].y); y <= max(p[0].y, p[1].y); y ++)    s.insert({p[1].x, y});
    if(abs(p[0].x-p[2].x)+abs(p[0].y-p[2].y) <= abs(p[2].x-p[1].x)+abs(p[2].y-p[1].y))
    {
        for(int x = min(p[2].x, p[0].x); x <= max(p[2].x, p[0].x); x ++)    s.insert({x, p[0].y});
        for(int y = min(p[2].y, p[0].y); y <= max(p[2].y, p[0].y); y ++)    s.insert({p[1].x, y});
    }
    else
    {
        for(int x = min(p[2].x, p[1].x); x <= max(p[2].x, p[1].x); x ++)    s.insert({x, p[1].y});
        for(int y = min(p[2].y, p[1].y); y <= max(p[2].y, p[1].y); y ++)    s.insert({p[2].x, y});
    }
	printf("%d\n", s.size());
	for(auto t : s) printf("%d %d\n", t.x, t.y);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <limits>
#include <ctime>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <iterator>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

template<typename ...> static inline int getchar_unlocked(void) { return getchar(); }
template<typename ...> static inline void putchar_unlocked(int c) { putchar(c); }
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void reader(ll& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
int reader(char c[]) { int i, s = 0; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c[s++] = i; for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c[s++] = i; }c[s] = '\0'; return s; }
int reader(string& c) { int i; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c.push_back(i); for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c.push_back(i); }; return sz(c); }
template <class T, class S> void reader(T& x, S& y) { reader(x); reader(y); }
template <class T, class S, class U> void reader(T& x, S& y, U& z) { reader(x); reader(y); reader(z); }
template <class T, class S, class U, class V> void reader(T& x, S& y, U& z, V & w) { reader(x); reader(y); reader(z); reader(w); }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(ll x, char c) { int s = 0, m = 0; char f[20]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(const char c[]) { int i; for (i = 0; c[i] != '\0'; i++)mypc(c[i]); }
void writer(const string& x, char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
void writer(const char x[], char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }
template<class T, class S> void writerLn(T x, S y) { writer(x, ' '); writer(y, '\n'); }
template<class T, class S, class U> void writerLn(T x, S y, U z) { writer(x, ' '); writer(y, ' '); writer(z, '\n'); }
template<class T, class S, class U, class V> void writerLn(T x, S y, U z, V v) { writer(x, ' '); writer(y, ' '); writer(z, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { if (!n) { mypc('\n'); return; }FOR(i, n - 1)writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerArr(vector<T>& x) { writerArr(x.data(), (int)x.size()); }

template<class T> void chmin(T& a, const T& b) { if (a > b) a = b; }
template<class T> void chmax(T& a, const T& b) { if (a < b) a = b; }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll mod_pow(ll a, ll n, ll mod) {
	ll ret = 1;
	ll p = a % mod;
	while (n) {
		if (n & 1) ret = ret * p % mod;
		p = p * p % mod;
		n >>= 1;
	}
	return ret;
}
template<class T> T extgcd(T a, T b, T& x, T& y) { for (T u = y = 1, v = x = 0; a;) { T q = b / a; swap(x -= q * u, u); swap(y -= q * v, v); swap(b -= q * a, a); } return b; }
ll mod_inv(ll a, ll m) { ll x, y; extgcd<ll>(a, m, x, y); return (m + x % m) % m; }

#ifdef _WIN32
template <typename ... Args>
void debugPrintf(const char *format, Args const & ... args) {
	fprintf(stdout, format, args ...);
	fflush(stdout);
}
#else
#define debugPrintf(...)
#endif

vector<set<Pii>> f(Pii a, Pii b) {
	if (a.first > b.first) {
		swap(a, b);
	}

	vector<set<Pii>> ret;
	{
		set<Pii> c;
		c.insert(a);
		c.insert(b);
		for (int x = a.first; x <= b.first; x++) c.insert(Pii(x, a.second));
		int d = a.second > b.second ? -1 : 1;
		for (int y = a.second; y != b.second; y += d) c.insert(Pii(b.first, y));
		ret.push_back(c);
	}

	{
		set<Pii> c;
		c.insert(a);
		c.insert(b);
		int d = a.second > b.second ? -1 : 1;
		for (int y = a.second; y != b.second; y += d) c.insert(Pii(a.first, y));
		for (int x = a.first; x <= b.first; x++) c.insert(Pii(x, b.second));
		ret.push_back(c);
	}

	return ret;
}

set<Pii> solve(set<Pii>& s, Pii a) {
	static int used[1001][1001];
	static Pii pv[1001][1001];
	memset(used, 0x10, sizeof(used));
	queue<Pii> q;
	for (auto x : s) used[x.first][x.second] = 0, q.push(x);

	while (!q.empty()) {
		Pii cur = q.front(); q.pop();
		if (cur == a) {
			break;
		}
		int i, j; tie(i, j) = cur;
		int d[] = { 0,1,0,-1,0 };
		FOR(k, 4) {
			int ni = cur.first + d[k], nj = cur.second + d[k + 1];
			if (ni < 0 || ni > 1000 || nj < 0 || nj > 1000) continue;
			int nc = used[i][j] + 1;
			if (nc < used[ni][nj]) {
				used[ni][nj] = nc;
				pv[ni][nj] = Pii(i, j);
				q.emplace(ni, nj);
			}
		}
	}

	Pii c = a;
	set<Pii> ret = s;
	ret.insert(c);
	while (used[c.first][c.second] != 0) {
		c = pv[c.first][c.second];
		ret.insert(c);
	}

	return ret;
}

set<Pii> mn(set<Pii> l, set<Pii> r) {
	return sz(l) < sz(r) ? l : r;
}

set<Pii> solve(vector<Pii> v) {
	auto paths = f(v[0], v[1]);
	auto path1 = solve(paths[0], v[2]);
	auto path2 = solve(paths[1], v[2]);

	return mn(path1, path2);
}

int main() {
	vector<Pii> vp;
	FOR(i, 3) {
		int a, b; reader(a, b);
		vp.emplace_back(a, b);
	}

	auto a1 = solve(vp);
	swap(vp[1], vp[2]);
	auto a2 = solve(vp);
	swap(vp[0], vp[2]);
	auto a3 = solve(vp);

	auto ans = mn(a1, mn(a2, a3));
	writerLn(sz(ans));
	for (auto x : ans) {
		writerLn(x.first, x.second);
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <limits>
#include <ctime>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <iterator>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

template<typename ...> static inline int getchar_unlocked(void) { return getchar(); }
template<typename ...> static inline void putchar_unlocked(int c) { putchar(c); }
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void reader(ll& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
int reader(char c[]) { int i, s = 0; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c[s++] = i; for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c[s++] = i; }c[s] = '\0'; return s; }
int reader(string& c) { int i; for (;;) { mygc(i); if (i != ' '&&i != '\n'&&i != '\r'&&i != '\t'&&i != EOF) break; }c.push_back(i); for (;;) { mygc(i); if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break; c.push_back(i); }; return sz(c); }
template <class T, class S> void reader(T& x, S& y) { reader(x); reader(y); }
template <class T, class S, class U> void reader(T& x, S& y, U& z) { reader(x); reader(y); reader(z); }
template <class T, class S, class U, class V> void reader(T& x, S& y, U& z, V & w) { reader(x); reader(y); reader(z); reader(w); }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(ll x, char c) { int s = 0, m = 0; char f[20]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writer(const char c[]) { int i; for (i = 0; c[i] != '\0'; i++)mypc(c[i]); }
void writer(const string& x, char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
void writer(const char x[], char c) { int i; for (i = 0; x[i] != '\0'; i++)mypc(x[i]); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }
template<class T, class S> void writerLn(T x, S y) { writer(x, ' '); writer(y, '\n'); }
template<class T, class S, class U> void writerLn(T x, S y, U z) { writer(x, ' '); writer(y, ' '); writer(z, '\n'); }
template<class T, class S, class U, class V> void writerLn(T x, S y, U z, V v) { writer(x, ' '); writer(y, ' '); writer(z, ' '); writer(v, '\n'); }
template<class T> void writerArr(T x[], int n) { if (!n) { mypc('\n'); return; }FOR(i, n - 1)writer(x[i], ' '); writer(x[n - 1], '\n'); }
template<class T> void writerArr(vector<T>& x) { writerArr(x.data(), (int)x.size()); }

template<class T> void chmin(T& a, const T& b) { if (a > b) a = b; }
template<class T> void chmax(T& a, const T& b) { if (a < b) a = b; }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll mod_pow(ll a, ll n, ll mod) {
	ll ret = 1;
	ll p = a % mod;
	while (n) {
		if (n & 1) ret = ret * p % mod;
		p = p * p % mod;
		n >>= 1;
	}
	return ret;
}
template<class T> T extgcd(T a, T b, T& x, T& y) { for (T u = y = 1, v = x = 0; a;) { T q = b / a; swap(x -= q * u, u); swap(y -= q * v, v); swap(b -= q * a, a); } return b; }
ll mod_inv(ll a, ll m) { ll x, y; extgcd<ll>(a, m, x, y); return (m + x % m) % m; }

#ifdef _WIN32
template <typename ... Args>
void debugPrintf(const char *format, Args const & ... args) {
	fprintf(stdout, format, args ...);
	fflush(stdout);
}
#else
#define debugPrintf(...)
#endif

vector<set<Pii>> f(Pii a, Pii b) {
	if (a.first > b.first) {
		swap(a, b);
	}

	vector<set<Pii>> ret;
	{
		set<Pii> c;
		c.insert(a);
		c.insert(b);
		for (int x = a.first; x <= b.first; x++) c.insert(Pii(x, a.second));
		int d = a.second > b.second ? -1 : 1;
		for (int y = a.second; y != b.second; y += d) c.insert(Pii(b.first, y));
		ret.push_back(c);
	}

	{
		set<Pii> c;
		c.insert(a);
		c.insert(b);
		int d = a.second > b.second ? -1 : 1;
		for (int y = a.second; y != b.second; y += d) c.insert(Pii(a.first, y));
		for (int x = a.first; x <= b.first; x++) c.insert(Pii(x, b.second));
		ret.push_back(c);
	}

	return ret;
}

set<Pii> solve(set<Pii>& s, Pii a) {
	static int used[1001][1001];
	static Pii pv[1001][1001];
	memset(used, 0x10, sizeof(used));
	queue<Pii> q;
	for (auto x : s) used[x.first][x.second] = 0, q.push(x);

	while (!q.empty()) {
		Pii cur = q.front(); q.pop();
		if (cur == a) {
			break;
		}
		int i, j; tie(i, j) = cur;
		int d[] = { 0,1,0,-1,0 };
		FOR(k, 4) {
			int ni = cur.first + d[k], nj = cur.second + d[k + 1];
			if (ni < 0 || ni > 1000 || nj < 0 || nj > 1000) continue;
			int nc = used[i][j] + 1;
			if (nc < used[ni][nj]) {
				used[ni][nj] = nc;
				pv[ni][nj] = Pii(i, j);
				q.emplace(ni, nj);
			}
		}
	}

	Pii c = a;
	set<Pii> ret = s;
	ret.insert(c);
	while (used[c.first][c.second] != 0) {
		c = pv[c.first][c.second];
		ret.insert(c);
	}

	return ret;
}

set<Pii> mn(set<Pii>& l, set<Pii>& r) {
	return sz(l) < sz(r) ? l : r;
}

set<Pii> solve(vector<Pii> v) {
	auto paths = f(v[0], v[1]);
	auto path1 = solve(paths[0], v[2]);
	auto path2 = solve(paths[1], v[2]);

	return mn(path1, path2);
}

int main() {
	vector<Pii> vp;
	FOR(i, 3) {
		int a, b; reader(a, b);
		vp.emplace_back(a, b);
	}

	auto a1 = solve(vp);
	swap(vp[1], vp[2]);
	auto a2 = solve(vp);
	swap(vp[0], vp[2]);
	auto a3 = solve(vp);

	auto ans = mn(a1, mn(a2, a3));
	writerLn(sz(ans));
	for (auto x : ans) {
		writerLn(x.first, x.second);
	}

	return 0;
}


#include <bits/stdc++.h>
struct pr {
	int x,y;
}p[10];
int cmp(pr a,pr b){return a.y<b.y;}
int minx=100000,miny=100000,maxx=0,maxy=0;
int main(){
	for(int i=1;i<=3;++i){
		scanf("%d%d",&p[i].x,&p[i].y);
		minx=std::min(minx,p[i].x);
		miny=std::min(miny,p[i].y);
		maxx=std::max(maxx,p[i].x);
		maxy=std::max(maxy,p[i].y);
	}printf("%d\n",maxx-minx+maxy-miny+1);
	std::sort(p+1,p+4,cmp);
	for(int i=minx;i<=maxx;++i)printf("%d %d\n",i,p[2].y);
	for(int i=miny;i<p[2].y;++i)printf("%d %d\n",p[1].x,i);
	for(int i=p[2].y+1;i<=maxy;++i)printf("%d %d\n",p[3].x,i);
	return 0;
}


#include <bits/stdc++.h>
#define il inline
#define ri register int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define MAXN 1050
#define MAXM
#define MOD
#define INF (1<<25)
#define eps (1e-6)
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define dwn(i, x, y) for(ri i = y; i >= x; --i)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair <int, int> pii;
typedef pair <LL, int> pli;
typedef pair <int, LL> pil;
typedef pair <LL, LL> pll;
template <typename T> inline bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> inline bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
il void read(int &qwq) {
	char ch = getchar(); int f = 1; qwq = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') qwq = qwq*10+ch-'0', ch = getchar();
	qwq *= f;
}
int n, vis[MAXN][MAXN];
vector <pii> ans;
struct node {
	int x, y;
	bool operator < (const node &a) const {
		return y < a.y;
	}
}t[4];
int main() {
	rep(i, 1, 3) read(t[i].x), read(t[i].y);
	sort(t+1, t+4);
	int mid = t[2].y;
	int maxx = max(max(t[1].x, t[2].x), t[3].x), minx = min(min(t[1].x, t[2].x), t[3].x);
//	cout<<minx<<' '<<maxx<<' '<<mid<<endl;
	rep(i, minx, maxx) vis[i][mid] = 1;//, cout<<"col: "<<i<<' '<<mid<<endl;
	rep(i, 1, 3) {
		rep(j, min(t[i].y, mid), max(t[i].y, mid)) vis[t[i].x][j] = 1;//, cout<<"col";
	}
	rep(i, 0, 1000)
		rep(j, 0, 1000)
			if(vis[i][j]) ans.pb(mp(i, j));
	cout<<ans.size()<<endl;
	for(auto v: ans)
		cout<<v.fir<<' '<<v.sec<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int max_n = 3, inf = 1000111222;

struct point {
    int x, y;

    void read() {
        cin >> x >> y;
    }

    bool operator < (const point &p) const {
        return x < p.x || x == p.x && y < p.y;
    }
};

point p[3];

int dist(int x, int y, const point &p) {
    return abs(x - p.x) + abs(y - p.y);
}

void write(int x, int y, point p) {
    while (x != p.x || y != p.y) {
        cout << p.x << " " << p.y << endl;
        if (p.x < x) {
            p.x += 1;
        } else if (p.x > x) {
            p.x -= 1;
        } else if (p.y < y) {
            p.y += 1;
        } else if (p.y > y) {
            p.y -= 1;
        }
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    p[0].read();
    p[1].read();
    p[2].read();
    int ans = inf;
    for (int x = 0; x < 1111; ++x) {
        for (int y = 0; y < 1111; ++y) {
            int res = 1;
            for (int i = 0; i < 3; ++i) {
                res += dist(x, y, p[i]);
            }
            ans = min(ans, res);
        }
    }
    for (int x = 0; x < 1111; ++x) {
        for (int y = 0; y < 1111; ++y) {
            int res = 1;
            for (int i = 0; i < 3; ++i) {
                res += dist(x, y, p[i]);
            }
            if (ans == res) {
                cout << ans << endl;
                cout << x << " " << y << endl;
                for (int i = 0; i < 3; ++i) {
                    write(x, y, p[i]);
                }
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 2e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dis(ll x1, ll y1, ll x2, ll y2){
	return abs(x1- x2) + abs(y1 - y2);
}
set<pll> an;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll x1, y1;
	cin >> x1 >> y1;
	ll x2, y2;
	cin >> x2 >> y2;
	ll x3, y3;
	cin >> x3 >> y3;
	ll xa = -1, ya = -1;
	ll ans = INF;
	for(int i = 0; i<=1000;i++){
		for(int j = 0;j<=1000;j++){
			ll d = dis(x3,y3,i,j) +dis(x2,y2,i,j)+dis(x1,y1,i,j);
			if(d < ans){
				ans = d;
				xa = i;
				ya = j;
			}
		}
	}
	//debug(xa);
	//debug(ya);
	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ max(x1,xa), i });

	x1 = x2;
	y1 = y2;

	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ max(x1,xa), i });

	x1 = x3;
	y1 = y3;

	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ max(x1,xa), i });
	cout << an.size() << '\n';
	for(auto x : an) cout << x.F << " " << x.S << '\n';
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 2e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll dis(ll x1, ll y1, ll x2, ll y2){
	return abs(x1- x2) + abs(y1 - y2);
}
set<pll> an;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll x1, y1;
	cin >> x1 >> y1;
	ll x2, y2;
	cin >> x2 >> y2;
	ll x3, y3;
	cin >> x3 >> y3;
	ll xa = -1, ya = -1;
	ll ans = INF;
	for(int i = 0; i<=1000;i++){
		for(int j = 0;j<=1000;j++){
			ll d = dis(x3,y3,i,j) +dis(x2,y2,i,j)+dis(x1,y1,i,j);
			if(d < ans){
				ans = d;
				xa = i;
				ya = j;
			}
		}
	}
	//debug(xa);
	//debug(ya);
	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ (min(ya,y1) == ya ? x1 : xa), i });

	x1 = x2;
	y1 = y2;

	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ (min(ya,y1) == ya ? x1 : xa), i });

	x1 = x3;
	y1 = y3;

	for(int i = min(xa,x1); i<=max(xa,x1); i++) an.insert({i, min(ya,y1)});
	for(int i = min(ya,y1);i<=max(ya,y1); i++) an.insert({ (min(ya,y1) == ya ? x1 : xa), i });
	cout << an.size() << '\n';
	for(auto x : an) cout << x.F << " " << x.S << '\n';
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define oo 1000000000
#define mod1 998244353
using namespace std;

int ans=1;
ll coun[2];

ll pow(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b%2!=0)
			res=(res*a)%mod1;
		a=(a*a)%mod1;
		b=b/2;
	}
	return res;
}

void dfs(int curr,int color[],int visited[],vector <int> v[])
{

	if(ans==0)
		return;
	for(int i=0;i<v[curr].size();i++)
	{
		if(visited[v[curr][i]]==0)
		{
			visited[v[curr][i]]=1;

			//level[v[curr][i]]=level[curr]+1;
			color[v[curr][i]]=1-color[curr];
			coun[1-color[curr]]++;
			dfs(v[curr][i],color,visited,v);
		}
		else
		{
			if(color[v[curr][i]]==color[curr])
				ans=0;
		}
	}
}
int main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 ll t;
	 // cin>>t;
	 // while(t--)
	 // {
	 	int x[3];
	 	int y[3];
	 	vector < pair<int,int> > v;
	 	for(int i=0;i<3;i++)
	 	{
	 		cin>>x[i]>>y[i];
	 		v.push_back(make_pair(y[i],x[i]));

	 	}
	 	sort(y,y+3);
	 	sort(x,x+3);
	 	sort(v.begin(),v.end());
	 	cout<<(x[2]-x[0]+y[2]-y[0]+1)<<endl;

	 	for(int i=y[0];i<=y[1];i++)
	 		cout<<v[0].second<<" "<<i<<endl;

	 	if(v[1].second>v[0].second)
	 	{
	 	for(int i=v[0].second+1;i<=v[1].second;i++)
	 		cout<<i<<" "<<y[1]<<endl;
	    }
	    else if(v[1].second<v[0].second)
	    {
	    		for(int i=v[0].second-1;i>=v[1].second;i--)
	 		cout<<i<<" "<<y[1]<<endl;

	    }

	  if(min(v[0].second,v[1].second)<=v[2].second&&max(v[0].second,v[1].second)>=v[2].second)
	  {
	  	for(int i=y[1]+1;i<=y[2];i++)
	 		cout<<v[2].second<<" "<<i<<endl;
	  }
	  else if(min(v[0].second,v[1].second)>v[2].second)
	  {
	  		for(int i=y[1]+1;i<=y[2];i++)
	 		cout<<min(v[0].second,v[1].second)<<" "<<i<<endl;
	 		for(int i=min(v[0].second,v[1].second)-1;i>=v[2].second;i--)
	 		cout<<i<<" "<<y[2]<<endl;

	  }
	  else if(max(v[0].second,v[1].second)<v[2].second)
	  {
	  		for(int i=y[1]+1;i<=y[2];i++)
	 		cout<<max(v[0].second,v[1].second)<<" "<<i<<endl;
	 		for(int i=max(v[0].second,v[1].second)+1;i<=v[2].second;i++)
	 		cout<<i<<" "<<y[2]<<endl;
	  }

	// }

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

	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;
}