334B.md (1459B)
1 Source: https://codeforces.com/problemset/problem/334/B 2 3 B. Eight Point Sets 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, except for the average of these nine points. In other words, there must be three integers *x*1, *x*2, *x*3 and three more integers *y*1, *y*2, *y*3, such that *x*1 < *x*2 < *x*3, *y*1 < *y*2 < *y*3 and the eight point set consists of all points (*x**i*, *y**j*) (1 ≤ *i*, *j* ≤ 3), except for point (*x*2, *y*2). 22 23 You have a set of eight points. Find out if Gerald can use this set? 24 25 Input 26 27 The input consists of eight lines, the *i*-th line contains two space-separated integers *x**i* and *y**i* (0 ≤ *x**i*, *y**i* ≤ 106). You do not have any other conditions for these points. 28 29 Output 30 31 In a single line print word "respectable", if the given set of points corresponds to Gerald's decency rules, and "ugly" otherwise. 32 33 Examples 34 35 Input 36 37 ``` 38 0 0 39 0 1 40 0 2 41 1 0 42 1 2 43 2 0 44 2 1 45 2 2 46 ``` 47 48 Output 49 50 ``` 51 respectable 52 ``` 53 54 Input 55 56 ``` 57 0 0 58 1 0 59 2 0 60 3 0 61 4 0 62 5 0 63 6 0 64 7 0 65 ``` 66 67 Output 68 69 ``` 70 ugly 71 ``` 72 73 Input 74 75 ``` 76 1 1 77 1 2 78 1 3 79 2 1 80 2 2 81 2 3 82 3 1 83 3 2 84 ``` 85 86 Output 87 88 ``` 89 ugly 90 ```