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