#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+1e4,M=1e3+1e2;
const ll Maxn=0x3ffffff,Minm=-0x3ffffff;
ll t;
ll a1,a2,b1,b2;
signed main()
{
cin>>t;
while(t--)
{
cin>>a1>>b1;
cin>>a2>>b2;
if(b1+b2<0)cout<<a1+a2<<b1+b2<<"i\n";
else if(b1+b2==0)cout<<a1+a2<<"\n";
else cout<<a1+a2<<"+"<<b1+b2<<"i\n";
}
}