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

struct dot{
    long x;
    long y;
};

dot dots[10000*10000];

int main() {
    int x, y,count = 0;
    while (cin >> x >> y) { // 注意 while 处理多个 case
        if(count == 0&&x == 0&&y == 0) break;
        else{
            if(x!=0||y!=0){
               dots[count].x = x;
               dots[count].y = y;
               count++;
            }else if(x==0&&y==0){
               long minX = 10000000000,minY = 10000000000,maxX = 0,maxY = 0;
               for(int i = 0; i < count;i++){
                   if(dots[i].x < minX) minX = dots[i].x;
                   if(dots[i].y < minY) minY = dots[i].y;
                   if(dots[i].x > maxX) maxX = dots[i].x;
                   if(dots[i].y > maxY) maxY = dots[i].y;
                }
                cout << minX << " "<< minY << " "<< maxX << " "<< maxY << " "<< endl;
                count = 0;
        }
        }
        
    }
}
// 64 位输出请用 printf("%lld")