#include<iostream.h>
class A
{
 protected:
   int a;
 public:
   void set(int x);
};
void A::set(int x)
{
   a=x;
}
class B:public A
{
 protected:
   int b;
};
class C:public A
{
 protected:
   int c;
};
class D:public B,public C
{
 private:
   int d;
 public:
   void set(int x);
   void display(void);
};
void D::set(int x)
{
  b=x;
  c=x+1;
  d=x+2;
}
void D::display(void)
{
   cout<<"B::a="<<B::a<<" C::a="<<C::a<<endl;
   cout<<"b="<<b<<" c="<<c<<" d="<<d<<endl;
}
int main()
{
   D s;
   s.set(1); 
   s.B::set(4);
   s.C::set(5);
   s.display();  
   return(0);
}
