#include<iostream.h>
class A
{
 public: 
   A(int x);
   ~A();
 protected:
   int a;
};
 A::A(int x)
{
   a=x;
   cout<<a<<"A";
}
 A::~A()
{
   cout<<a;
}
 class B:public A
{
 private:
   int b;
   int c;
   const int d;
   A m;
   A n;
 public:
   B(int x);
   ~B();
};
 B::B(int x):b(x),n(b+1),m(b+2),d(b+1),A(x+3)
{
   c=x+2;
   cout<<b<<c<<d;
   cout<<"B"<<endl;
}
 B::~B()
{
   cout<<"C"; 
}
int main()
{
 B s(0);
 return(0);
}