The current solution gives a segmentation fault. This can be solved by changing `if(q.front()->left)` to `if(q.front()->right)` on line number 29.