#include <iostream>
#include <string.h>
#include <vector>
#include <stdio.h>
using namespace std;
int main(void) {
int n, m, x, y, z;
vector<string> inputs;
string read;
while (1){
getline(cin, read);
if(!read.compare("0 0"))
break;
inputs.push_back(read);
}
sscanf(inputs[0].c_str(), "%d %d", &n, &m);
sscanf(inputs[1].c_str(), "%d %d %d", &x, &y, &z);
cout<<n<<" "<<m<<endl;
cout<<x<<" "<<y<<" "<<z<<endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzdGRpby5oPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpIHsKCglpbnQgbiwgbSwgeCwgeSwgejsKICAgIHZlY3RvcjxzdHJpbmc+IGlucHV0czsKICAgIHN0cmluZyByZWFkOwogICAgd2hpbGUgKDEpewogICAgICAgIGdldGxpbmUoY2luLCByZWFkKTsKICAgICAgICBpZighcmVhZC5jb21wYXJlKCIwIDAiKSkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgaW5wdXRzLnB1c2hfYmFjayhyZWFkKTsKICAgIH0KICAgIHNzY2FuZihpbnB1dHNbMF0uY19zdHIoKSwgIiVkICVkIiwgJm4sICZtKTsKICAgIHNzY2FuZihpbnB1dHNbMV0uY19zdHIoKSwgIiVkICVkICVkIiwgJngsICZ5LCAmeik7CgogICAgY291dDw8bjw8IiAiPDxtPDxlbmRsOwogICAgY291dDw8eDw8IiAiPDx5PDwiICI8PHo8PGVuZGw7CiAgICAKICAgIHJldHVybiAwOwp9Cg==