/* █████ ██████ █████ ███████ █████ ████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ███████ █████ ███████ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣶⣶⣶⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀ ⠀⣀⠀⠀⠀⢀⣠⣤⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⢸⠿⣿⣿⣿⣿⣿⠟⢿⢀⣠⣴⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣶⣀⠀ ⢀⣘⣷⢻⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣷⣶⣾⠀⠈⢻⣿⡿⠁⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠛⠹⢿⣿⣧⣟⠛⠀ ⠈⠿⠿⣿⡿⠻⠟⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⣀⣿⣦⣀⣴⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⢠⡿⠉⠛⣷⡀ ⠀⠀⠀⣽⡇⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠘⠃⠀⠀⠈⠁ ⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⢻⠿⠿⠟⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡿⡿⢿⣿⣿⠀⠀⣿⣿⣿⣿⣷⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢾⣿⣶⣿⢿⡄⢠⣿⣿⣾⣿⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⢀⣴⣶⣶⣶⣶⣤⣤⣤⣄⣀⠀⠀⢻⣿⣿⣿⠃⠘⣿⣿⣿⣿⣿⠀⠀⣀⣤⣤⣶⣶⣶⣶⣾⣿⣦⡀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣼⣿⣿⣿⠀⠀⢸⣿⣿⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⢿⣿⣿⣿⣿⣿⠿⠿⠛⠛⠿⣿⣿⣿⣿⣿⠿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣿⣿⣆⠀⠀⠀⣰⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣦⠀⣴⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⡉⢉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ */ #include #include using namespace std; #define FAST ios_base::sync_with_stdio(false); #define FAST_INPUT cin.tie(0); #define FAST_OUTPUT cout.tie(0); #define ll long long #define ld long double #define vi vector #define vll vector #define vpll vector> #define pll pair #define gcd __gcd #define S string #define inf 1e18 #define minf INT_MIN #define lmax LLONG_MAX #define pb push_back #define ff first #define ss second #define f(i,a,n) for(long long int i=a;i=n;i--) #define w(t) int t; cin>>t; f(case_num,1,t+1) #define odd(n) (n&1) #define even(n) !(n&1) #define endl "\n" #define all(x) x.begin(),x.end() #define yes() cout<<"YES"< seive() { vectorisprime(N,true); isprime[0]=isprime[1]=false; f(i,2,N+1) { if(isprime[i]) { for(ll j=2*i;j<=N;j+=i) { isprime[j]=0; } } } vector prime; f(i,2,N+1) { if(isprime[i]) { prime.pb(i); } } return prime; } //bit array for the fenwick tree ll bit[N]={0}; //fenwick tree update void fenwick(ll ind,ll x,ll n) { for(;ind<=n;ind+=(ind&(-ind))) { bit[ind]+=x; } } //fenwick tree retrieval ll fenwick_sum(ll ind1) { ll i=ind1; ll ans=0; while(i) { ans+=bit[i]; i-=(i&(-i)); } return ans; } ll segment_tree[N]={0}; void build(ll ind,ll start,ll end,vll &v) { if(start==end) { segment_tree[ind]=v[end-1]; return; } ll mid=(start+end)/2; build(2*ind,start,mid,v); build(2*ind+1,mid+1,end,v); segment_tree[ind]=min(segment_tree[2*ind],segment_tree[2*ind+1]); } ll an(ll ind,ll a,ll b,ll x,ll y) { if(xb&&y>b) { return inf; } if(a>=x&&b<=y) { return segment_tree[ind]; } ll mid=(a+b)/2; ll p=an(2*ind,a,mid,x,y); ll q=an(2*ind+1,mid+1,b,x,y); return min(p,q); } void update(ll ind,ll start,ll end,ll x,ll u) { if(xstart&&x>end) { return; } if(x==start&&x==end) { segment_tree[ind]=u; return; } if(start==end) { return; } ll mid=(start+end)/2; update(2*ind,start,mid,x,u); update(2*ind+1,mid+1,end,x,u); segment_tree[ind]=min(segment_tree[2*ind],segment_tree[2*ind+1]); } //SIGMA N ll sigma(ll n) { return (n*(n+1))/2; } //SQUARE ROOT OF A NUMBER ll sq(ll n) { ll ans=0; ll i=0; ll j=sqrt(n)+4; while(i<=j) { ll mid=i+(j-i)/2; if(mid*mid>n) { j=mid-1; } else { i=mid+1; ans=mid; } } return ans; } //SUM OF DIGITS ll sum(ll n) { ll ct=0; while(n) { ct+=(n%10); n/=10; } return ct; } void func(vector>a,vector>b) { } int main() { FAST; FAST_INPUT; FAST_OUTPUT; vector>dp(2,vector(2,0)); f(i,0,2) { f(j,0,2) { cin>>dp[i][j]; } } vector>dp1=dp; dp1[0][0]=dp[0][0]*dp[0][0]+dp[0][1]*dp[1][0]; dp1[0][1]=dp[0][0]*dp[0][1]+dp[0][1]*dp[1][1]; dp1[1][0]=dp[1][0]*dp[0][0]+dp[1][1]*dp[0][1]; dp1[1][1]=dp[1][0]*dp[0][1]+dp[1][1]*dp[1][1]; vector>dp2=dp1; dp2[0][0]=dp1[0][0]*dp[0][0]+dp1[0][1]*dp[1][0]; dp2[0][1]=dp1[0][0]*dp[0][1]+dp1[0][1]*dp[1][1]; dp2[1][0]=dp1[1][0]*dp[0][0]+dp1[1][1]*dp[0][1]; dp2[1][1]=dp1[1][0]*dp[0][1]+dp1[1][1]*dp[1][1]; f(i,0,2) { f(j,0,2) { cout<