#include<stdio.h> #include<iostream> #include<string> using namespace std; typedef long long ll; /*float stof(const string& str, size_t *idx = 0); double stod(const string& str, size_t *idx = 0); long double stold(const string& str, size_t *idx = 0); int stoi(const string& str, size_t *idx = 0, int base = 10); long stol(const string& str, size_t *idx = 0, int base = 10); unsigned long stoul(const string& str, size_t *idx = 0, int base = 10); long long stoll(const string& str, size_t *idx = 0, int base = 10); unsigned long long stoull(const string& str, size_t *idx = 0, int base = 10); */ int main() { string a,b,c; char a1,b1; ll t; cin >>t; while(t--) { cin >>a>>a1>>b>>b1>>c; ll k,i; for(i=0;i<a.size();i++) { if(a[i]=='m') { k=0; break; } } for(i=0;i<b.size();i++) { if(b[i]=='m') { k=1; break; } } for(i=0;i<c.size();i++) { if(c[i]=='m') { k=2; break; } } if(k==0) cout << stoll(c)-stoll(b)<< " + "<<b<< " = "<< c << endl; else if(k==1) cout << a<< " + "<<stoll(c)-stoll(a)<< " = "<<c<< endl; else cout << a<< " + "<<b<< " = "<<stoll(a)+stoll(b)<< endl; } return 0; }