There are 4 persons A,B,C and D of which 2 are liars and 2 are knights. Each of these persons has a lucky and an unlucky number. All the 8 numbers are different and they are from 1 to 9 only. It is known that sum of lucky and unlucky numbers is same for all of these 4 persons and also sum of lucky numbers is greater than sum of unlucky numbers. Find the lucky and unlucky numbers for each of them if they made the following statements:

A:

C's lucky number is 7.

The *missing number* is 5.

B:

C's unlucky number is 4.

D's lucky number is 2.

C:

A is a liar.

B's lucky number is 6.

D:

The product of B's numbers is 24.

The maximum of all our numbers is A's lucky number.

Note: The *missing number* is the number from 1 to 9 which is not any one of these people's lucky or unlucky number.

Since the sums of lucky and unlucky numbers are the same for all players, the missing number can only be 1,5 or 9 with sums of respectively 11, 10 or 9. We consider these 3 cases separately.

* missing number = 1.

This means A is a liar (he lies about the missing number), implying C is a knight. B's lucky number must be 6, B's unlucky number (11-6)=5. 6x5 != 30 implies D is a liar, which makes B a knight. Then C's unlucky number must be 4, which makes his unlucky number 7, which is what A said. This gives a conflict with A being a liar.

* missing number = 5

This means A is a knight, and C is a liar. The lucky number of C is 7, the unlucky number of C is 3. This makes B a liar and D a knight. If the product of B's numbers is 24, and 3 is already taken by C, B's numbers must be 4 and 6. As C is a liar, B's unlucky number must be 6, his lucky number 4. As D is a knight, A's lucky number must be 9, his unlucky number 1. D has number 2 and 8; with B being a liar D's lucky number must be 8 and his unlucky number 2. This gives a valid solution.

* missing number = 9.

This means A is a liar, C a knight. B's lucky number must be 6, his unlucky number 3, which makes D a liar about the product of B's numbers. B must be a knight, making C's unlucky number 4 and his lucky number 5. This gives a conflict with what A says about this number.

The only solution is:

lucky number A: 9

unlucky number A: 1

lucky number B: 4

unlucky number B: 6

lucky number C: 7

unlucky number C: 3

lucky number D: 8

unlucky number D: 2