first code for ch12