A queue of pairs to do bfs traversal and keep track if the node is a left or right child if bool value is true then it is a left child .
Queue < pair > q = new Queue < pair > ( ) ; q . Enqueue ( new pair ( root , false ) ) ; int sum = 0 ;