Fish

Advanced Circular Aquariums (ACM) is a state-of-the-art manufacturer of aquariums that can detect when two types of fish can be separated into two different zones for feeding. This solves the problem of having fish with different dietary needs in the same aquarium. The technology offered by ACM is based on a powerful real-time computer vision system placed on top of the aquariums. For each fish in the aquarium, the computer vision system determines the (x, y) coordinate and type t, which is either ‘A’ or ‘B’. The goal of the entire system is to detect when the two types of fish can be completely separated by a flat glass panel running from the edges of the aquarium and from surface to bottom (without touching any fish). The figures below depict two scenarios output by the computer vision system. In the one on the left, the two types of fish can be separated by a single flat glass panel. However, in the scenario on the right, the two types of fish cannot be completely separated by a single flat glass panel. Fish types can be separated Fish types cannot be separated You have been hired to process the output of the computer vision system. Your task is to write a computer program to determine, for a given state of the aquarium, whether the two types of fish can be separated with a single flat glass panel. Input The input consists of several test cases. Each test case starts with a line containing two blank-separated integers n and r, where n is the total number of fish (2 ≤ n ≤ 500) and r is the radius of the aquarium (0 < r ≤ 104). Then n lines follow, each one containing three blank-separated values xi, yi, and ti, where (xi, yi) are the integer coordinates (xi2 + yi2 ≤ r) and ti is the type (‘A’ or ‘B’) of the i-th fish. A line with two zeros ‘0 0’ indicates the end of the input. You may suppose that: the aquarium’s center is located at (0,0), no two fish share the same coordinates, the size and form of the fish are negligible, and there is at least one fish of each type. Output For each test case, print a single line with the text ‘FEED’ if the fish can be separated with a single glass panel without touching any fish or the text ‘NOT YET’ if this is not possible.

2/2 Sample Input 10 3 00A -2 0 A -1 -1 A -1 -2 A 1 -2 A 11B 01B 10B 20B 2 -1 B 93 00A -1 -1 A -2 -1 A 2 -1 A 11A -1 1 B 1 -1 B 02B 0 -2 B 00 Sample Output FEED NOT YET