The combination of NAND gates shown here under are equivalent to
An OR and AND gates respectively
An AND and NOT gates respectively
An AND and OR gates respectively
An OR and NOT gates respectively
The following connection of NAND gate behaves like NOT gate.
For First Circuit C=A¯.B¯¯=A¯¯+B¯¯ =A+B (OR) For Second Circuit C=A.B¯¯ =A.B (AND)