#include<iostream>
?#include<cmath>
?using?namespace?std;
??
class?fraction{
public:
??int?above;
??int?below;
??void?reduction();
??void?makeCommond(fraction&);
?public:
??fraction(int?a=0,int?b=1){
???above=a;below=b;
??}
??fraction?add(fraction);
??fraction?sub(fraction);
??fraction?mul(fraction);
??fraction?div(fraction);
??void?display();
?};
?void?fraction::reduction(){
??int?a,b,temp;
??if(below<0){
???above=-above;
???below=-below;
??}
??a=abs(above);
??b=abs(below);
??while(a%b){
???temp=a;
???a=b;
???b=temp%b;
??}
??above/=b;
??below/=b;
?}
?void?fraction::makeCommond(fraction&?b){
??int?temp;
??reduction();
??b.reduction();
??above*=b.below;
??b.above*=below;
??temp=below*b.below;
??below=b.below=temp;
?}
?fraction?fraction::add(fraction?b){
??fraction?temp;
??makeCommond(b);
??
??temp.above=above+b.above;
??temp.below=below;
??temp.reduction();
??
??return?temp;
?}
?fraction?fraction::sub(fraction?b){
??fraction?temp;
??makeCommond(b);
?
??temp.above=above-b.above;
??temp.below=below;
??temp.reduction();
??return?temp;
?}
?fraction?fraction::mul(fraction?b){
??fraction?temp;
??
??temp.above=above*b.above;
??temp.below=below*b.below;
??temp.reduction();
??return?temp;
?}
?fraction?fraction::div(fraction?b){
??fraction?temp;
??if(b.above==0){
???cout<<"零不能作除數(shù)!"<<endl;
???exit(1);
??}
??temp.above=above*b.below;
??temp.below=below*b.above;
??temp.reduction();
??return?temp;
?}
?void?fraction::display(){
??reduction();
??cout<<above<<"/"<<below<<"?";
?}
?int?main(){
??int?n;
??cin>>n;
??while(n>=1){
?? fraction?f1,f2;
?? cin>>f1.above>>f1.below>>f2.above>>f2.below;
????fraction?f3=f1.add(f2);
????fraction?f4=f1.sub(f2);
????fraction?f5=f1.mul(f2);
????fraction?f6=f1.div(f2);
?? f3.display();
?? f4.display();
?? f5.display();
?? f6.display();
?? cout<<endl;
??}
??return?0;
?}