#include <iostream> #include <string> using namespace std; //判断是否a < b; bool cmp(string a, string b) { if(a[0] == '-' && b[0] == '-') return !cmp(a.substr(1), b.substr(1)); else if(a[0] == '-' || b[0] == '-') return a[0] == '-'; if(a.size() != b.size()) return a.size() < b.size(); for(int i = 0; i < a.size(); i ++) { if(a[i] != b[i]) return a[i] < b[i]; } return false; } int main() { bool flag = false; string lt = "999999999999999999", rb = "-" + lt; string a, b; pair<string, string> l_top, r_bottom; l_top = {lt, lt}, r_bottom = {rb, rb}; while (cin >> a >> b) { // 注意 while 处理多个 case if(a != "0" || b != "0") { if(cmp(a, l_top.first)) l_top.first = a; if(cmp(b, l_top.second)) l_top.second = b; if(!cmp(a,r_bottom.first)) r_bottom.first = a; if(!cmp(b, r_bottom.second)) r_bottom.second = b; flag = true; } else { if(!flag) break; cout << l_top.first << " " << l_top.second << " "; cout << r_bottom.first << " " << r_bottom.second << endl; l_top = {lt, lt}, r_bottom = {rb, rb}; flag = false; } } return 0; } // 64 位输出请用 printf("%lld")