removing duplicates in multiple inheritance(with diamond inheritance)

But a is initialised by both N and O constructor

This assumption is incorrect. If virtual inheritance worked like this, it would not solve diamond problem (1 constructor call = 1 object created, if both N and O called constructor of M, you would have 2 M objects, like without virtual inheritance).

Instead, virtual base classes are always initialized by the most derived class, in this case P. Since you do not specify initialization of M in P constructor, default constructor is used. To use parameterized constructor, specify it in member initializer list:

P::P(int aVal, int bVal, int cVal, int dVal): M(aVal), N(aVal,bVal), O(aVal,cVal), d(dVal)
{
}

Note that aVal in N and O may be unused. You might want to refactor code to include the fact that you are using virtual inheritance and remove those parameters (or add separate constructors without them if you are going to use N or O directly).