$A$ completes $\frac1{12}$ part of the work in $1$ day
$B$ completes $\frac1{18}$ part in $1$ day
So, in consecutive $2$ days, $A,B$ will complete $\displaystyle\frac1{12}+\frac1{18}=\frac5{36}$ part of the whole work
Now, $\left\lfloor \frac{36}5\right \rfloor=7$
So, in $2\cdot7=14$ days, they will complete $7\cdot\frac5{36}=\frac{35}{36}$ part of the whole work
The rest part of the work is $1-\frac{35}{36}=\frac1{36}$ and now it will be $A$'s turn first.
Now, $A$ does $\frac1{12}$ part in $1$ day
Can you take it from here?