Day 8: Complete P46 and P47

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>