#include <iostream>
using namespace std;
class Building
{ int Floors,Rooms; double Total_area;
public:
Building( int f,int r,double t)
{ Floors=f; Rooms=r; Total_area=t; }
void disp_b()
{ cout<<"Floors:"<<Floors<<endl;
cout<<"Rooms:"<<Rooms<<endl;
cout<<"Total area:"<<Total_area<<endl;
}
};
class Housing : public Building
{ int Bedrooms,Bathrooms;
public:
Housing( int f,int r,double t,int be,int ba): Building(f,r,t)
{ Bedrooms=be; Bathrooms=ba; }
void disp_h()
{ cout<<"HOUSING:"<<endl;
disp_b();
cout<<"Bedrooms:"<<Bedrooms<<endl;
cout<<"Bathrooms:"<<Bathrooms<<endl;
}
};
class Office : public Building
{ int Extinguishers,Phones;
public:
Office( int f,int r,double t,int ex,int ph) :Building(f,r,t)
{ Extinguishers=ex; Phones=ph; }
void disp_o()
{ cout<<"OFFICING:"<<endl;
disp_b();
cout<<"Extinguishers:"<<Extinguishers<<endl;
cout<<"Phones:"<<Phones<<endl;
}
};
int main( )
{ int t,a,b,d,e; double c;
cin>>t;
while (t--)
{ cin>>a>>b>>c>>d>>e; Housing h1(a,b,c,d,e);
cin>>a>>b>>c>>d>>e; Office o1(a,b,c,d,e);
h1.disp_h(); o1.disp_o();
}
return 0;
}