#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c,d,e,f,g,h;
cin>>n>>a>>b>>c>>d>>e>>f>>g>>h;
if(b-a==c-b==d-c)
cout<<a<< " "<<b<< " " << c<<" " << d<<" "<<d+(d-c)<<endl ;
else if(b/a==c/b)
cout<<a<< " "<<b<< " " << c<<" " << d<<" "<<d*(d/c) <<endl;
if(f-e==g-f==h-g)
cout<<e<< " "<<f<< " " << g<<" " << h<<" "<<h+(h-g) ;
else if(f/e==g/f)
cout<<e<< " "<<f<< " " << g<<" " << h<<" "<<h*(h/g) ;
}