Honed Hops
In the Olympics, appearances do matter! The trajectory of a long jumper is given by h(x) = max(0, p(x)), where p(x) = a(x − h)^2 + k is a quadratic polynomial describing a parabola opening downward whose vertex (h, k) lies in the upper half-plane. (That is, a < 0 and k > 0.) Due to rigorous training, each jumper always jumps with the same trajectory, and due to corporate sponsorship and branding requirements, no two jumpers have the same trajectory. Adoring fans who wish to preserve the moment occasionally sample their favorite athlete’s coordinates at various times and write them down, such as: (0, 0), (1, 3), (2, 4), (3, 3), (4, 0), (7, 0). Given two sample sets, your job is to determine whether they were taken from the same athlete or not, assuming there is enough information to do so. Input The input test file will contain multiple cases, each separated by a blank line. Each test case consists of three lines of text. The first line contains two integers, n_1 and n_2 (1 ≤ n_1, n_2 ≤ 10) separated by a space, indicating the number of sample points for the first and second sample sets, respectively. The second and third lines contain the sample points for the two sets, in the format x_1 y_1 x_2 y_2 ... x_n y_n. You may assume that x_1 < x_2 < ... < x_n; moreover, 0 ≤ x_i ≤ 100, 000 and 0 ≤ y_i ≤ 1000 for each i. (Be careful that your calculations have sufficient precision for all input conforming to the stated bounds.) Input is terminated by a single line containing "0 0"; do not process this case. Output For each test case, your program should output a single line containing "same" if the two sample sets are indeed from the same athlete, "different" if they are not, and "unsure" if there is not enough information to tell.