while queue is not empty - dequeue p from queue - if in(p) > out(p) label p as inside else label p as outside - propagate label to nearby poles