set of N line segments as a (2*N, 2) grid output the grid and reset the queue append the appropriate line segments to the queue and update the current position. only knows about PA, PD, PU.