A gnu is an African antelope that looks like an ox. Rick the persistent gnu is the leading bull of a herd of gnus. During the dry seasons, he leads his herd towards a greener pasture called Fair Sight (FS). On his way towards FS, Rick has to make many stops at small intermediate feeding sites to get his herd refreshed.
Researchers at the Migration Investigation Team (MIT) found that gnus cannot travel further than D units of distance between two sites. They also observe that Rick is very persistent and serious about following the right direction. He always travels in straight lines, making stops and possibly changing directions only at a feeding site. He never leads the herd in any direction that points away from FS - the worst he would ever do is following a direction perpendicular to FS. In fact, he always chooses, among all possible sites, the one pointing in the direction closest to that of FS. Possibly in order to reduce the herds confusion, however, Rich excludes from consideration sites that would make the change of directions more abrupt than a right angle (i.e., deviating from the previous traveling segment by more than 90 degrees), even if they might be in the direction closer to that of FS than other feasible sites are.
Given the map of the possible feeding sites, the direction of Fair Sight, and the starting point of the gnu herd, you will help the Migration Investigation Team forecast the path of the herd as far as the map allows.
Consider the example above, where Rick starts from site 3 and D is 170.0. The big arrow points in the direction of FS. From site 3, sites 2 and 5 are the only two sites within the distance of D. He proceeds to site 2 since the direction of site 2 as seen from site 3 is more in line with FS than site 5. From site 2, he does not travel to site 5 since it is at a direction pointing away from FS. He then proceeds to site 4, the only possible next step. Now site 1 becomes within reach and seems somewhat in line with FS. It is excluded from consideration however, since it requires taking a very sharp turn, more than 90 degrees counterclockwise. Going towards site 7 would not make a very sharp turn but it leads away from FS. Site 7 is out of reach. So the path stops here.