#include <iostream>
using namespace std;
int main(){
int iSer[4];
int iIes[4];
int a , i , d , h;
cin >> a;
cin >> iSer[0] >> iSer[1] >> iSer[2] >> iSer[3];
cin >> iIes[0] >> iIes[1] >> iIes[2] >> iIes[3];
for (i = 0;i <= 0;i++){
d = iSer[1] - iSer[0];
iSer[4] = iSer[3] + d;
cout << iSer[0] << " " << iSer[1] << " " << iSer[2] << " " << iSer[3] << " " << iSer[4] << endl;
}
for (i = 0;i <= 0;i++){
h = iIes[1] / iIes[0];
iIes[4] = iIes[3] * h;
cout << iIes[0] << " " << iIes[1] << " " << iIes[2] << " " << iIes[3] << " " << iIes[4] << endl;
}
return 0;
}