#include <bits/stdc++.h>   using namespace std;   vector<int> di = {0, 0, 1, -1};   vector<int> dj = {1, -1, 0, 0};   int main() {     ios::sync_with_stdio(0), cin.tie(0);     vector<vector<int>> dpa(1001, vector<int>(1001, 2140000000));     vector<vector<int>> dpb(1001, vector<int>(1001, 2140000000));     vector<vector<int>> dpc(1001, vector<int>(1001, 2140000000));     vector<vector<pair<int, int>>> pa(         1001, vector<pair<int, int>>(1001, {2140000000, 0}));     vector<vector<pair<int, int>>> pb(         1001, vector<pair<int, int>>(1001, {2140000000, 0}));     vector<vector<pair<int, int>>> pc(         1001, vector<pair<int, int>>(1001, {2140000000, 0}));     int xa, ya;     cin >> xa >> ya;     dpa[xa][ya] = 0;     int xb, yb;     cin >> xb >> yb;     dpb[xb][yb] = 0;     int xc, yc;     cin >> xc >> yc;     dpc[xc][yc] = 0;     queue<pair<int, int>> q;     q.push({xa, ya});     while (!q.empty()) {       int vx = q.front().first;       int vy = q.front().second;       q.pop();       for (int i = 0; i < 4; i++) {         int tx = vx + di[i];         int ty = vy + dj[i];         if (tx >= 0 && tx <= 1000 && ty >= 0 && ty <= 1000 &&             dpa[tx][ty] == 2140000000) {           q.push({tx, ty});           dpa[tx][ty] = dpa[vx][vy] + 1;           pa[tx][ty] = {vx, vy};         }       }     }     q.push({xb, yb});     while (!q.empty()) {       int vx = q.front().first;       int vy = q.front().second;       q.pop();       for (int i = 0; i < 4; i++) {         int tx = vx + di[i];         int ty = vy + dj[i];         if (tx >= 0 && tx <= 1000 && ty >= 0 && ty <= 1000 &&             dpb[tx][ty] == 2140000000) {           q.push({tx, ty});           dpb[tx][ty] = dpb[vx][vy] + 1;           pb[tx][ty] = {vx, vy};         }       }     }     q.push({xc, yc});     while (!q.empty()) {       int vx = q.front().first;       int vy = q.front().second;       q.pop();       for (int i = 0; i < 4; i++) {         int tx = vx + di[i];         int ty = vy + dj[i];         if (tx >= 0 && tx <= 1000 && ty >= 0 && ty <= 1000 &&             dpc[tx][ty] == 2140000000) {           q.push({tx, ty});           dpc[tx][ty] = dpc[vx][vy] + 1;           pc[tx][ty] = {vx, vy};         }       }     }     int ans = 2140000000;     int ansx;     int ansy;     for (int i = 0; i <= 1000; i++) {       for (int j = 0; j <= 1000; j++) {         if (dpa[i][j] + dpb[i][j] + dpc[i][j] + 1 < ans) {           ans = dpa[i][j] + dpb[i][j] + dpc[i][j] + 1;           ansx = i;           ansy = j;         }       }     }     cout << ans << endl;     int sax = ansx;     int say = ansy;     int sbx = ansx;     int sby = ansy;     int scx = ansx;     int scy = ansy;     vector<vector<int>> used(1001, vector<int>(1001, 0));     while (make_pair(sax, say) != make_pair(2140000000, 0)) {       int tx = sax;       sax = pa[sax][say].first;       say = pa[tx][say].second;       if (make_pair(sax, say) != make_pair(2140000000, 0) && !used[sax][say]) {         cout << sax <<     << say << endl;         used[sax][say] = 1;       }     }     while (make_pair(sbx, sby) != make_pair(2140000000, 0)) {       int tx = sbx;       sbx = pb[sbx][sby].first;       sby = pb[tx][sby].second;       if (make_pair(sbx, sby) != make_pair(2140000000, 0) && !used[sbx][sby]) {         cout << sbx <<     << sby << endl;         used[sbx][sby] = 1;       }     }     while (make_pair(scx, scy) != make_pair(2140000000, 0)) {       int tx = scx;       scx = pc[scx][scy].first;       scy = pc[tx][scy].second;       if (make_pair(scx, scy) != make_pair(2140000000, 0) && !used[scx][scy]) {         cout << scx <<     << scy << endl;         used[scx][scy] = 1;       }     }     cout << ansx <<     << ansy << endl;     return 0;   }