This version works perfectly. The only mistake in previous version is my misunderstanding of P_(ab) operators.