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).

You have a set of eight points. Find out if Gerald can use this set?


-----Input-----

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} ≤ 10^6). You do not have any other conditions for these points.


-----Output-----

In a single line print word "respectable", if the given set of points corresponds to Gerald's decency rules, and "ugly" otherwise.


-----Examples-----
Input
0 0
0 1
0 2
1 0
1 2
2 0
2 1
2 2

Output
respectable

Input
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0

Output
ugly

Input
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2

Output
ugly

Difficulty: interview

Starter code:

Solutions:
X=[]
Y=[]
Points=[]
k=False
for i in range(8):
    x,y=list(map(int,input().split()))
    X.append(x)
    Y.append(y)
    if([x,y] in Points):
        k=True
    Points.append([x,y])
X.sort()
Y.sort()

if(len(set(X))!=3 or len(set(Y))!=3 or k):
    print("ugly")

elif(X.count(X[0])!=3 or X.count(X[3])!=2 or X.count(X[5])!=3):
    print("ugly")

elif(Y.count(Y[0])!=3 or Y.count(Y[3])!=2 or Y.count(Y[5])!=3):
    print("ugly")

elif([X[3],Y[3]] in Points):
    print("ugly")

else:
    print("respectable")


#f = open('data.txt')
lists=[]
dicts={}
sets = set()

for i in range(8):
    lists.append(tuple(input().split()))
'''for x in f:
    lists.append(tuple(x.split()))'''
for x in lists:
    sets.add(x)
    
if len(sets) == 8:
    for x in range(8):
        count = dicts.get(int(lists[x][0]),0)
        dicts[int(lists[x][0])] = count+1

    if len(list(dicts.keys()))==3:
        temp = sorted(dicts.items())
        if temp[0][1]==3 and temp[1][1] == 2 and temp[2][1] ==3:
            dicts.clear()
            for x in range(8):
                count = dicts.get(int(lists[x][1]),0)
                dicts[int(lists[x][1])] = count+1
            if len(list(dicts.keys()))==3:
                temp = sorted(dicts.items())
                if temp[0][1]==3 and temp[1][1] == 2 and temp[2][1] ==3:
                    print('respectable')
                else:
                    print('ugly')
            else:
                print('ugly')
        else:
            print('ugly')

    else:
        print('ugly')
else:
    print('ugly')


X = dict()
Y = dict()
A = set()

for i in range(8):
    x, y = list(map(int, input().split()))

    if (x, y) in A:
        print('ugly')
        return
    else:
        A.add((x, y))
    
    if x in X:
        X[x] += 1
    else:
        X[x] = 1

    if y in Y:
        Y[y] += 1
    else:
        Y[y] = 1

X = [(i, X[i]) for i in X]
Y = [(i, Y[i]) for i in Y]
X.sort()
Y.sort()

if len(X) == 3 and len(Y) == 3 and X[0][1] == 3 and X[1][1] == 2 and X[2][1] == 3 and Y[0][1] == 3 and Y[1][1] == 2 and Y[2][1] == 3:
    print('respectable')
else:
    print('ugly')


#input = open('input.txt', 'r')
#output = open('output.txt', 'w')

xx = set()
yy = set()
l = set()
for i in range(8):
    a = list(map(int, input().split()))
    x, y = a[0], a[1]
    l.add((x, y))
    xx.add(x)
    yy.add(y)

ok = 1
if (len(xx) != 3) or (len(yy) != 3) or (len(l) != 8): ok = 0
else:
    ax = list(xx)
    ay = list(yy)
    ax.sort()
    ay.sort()
    if (ax[1], ay[1]) in l: ok = 0


if ok == 1:
    print('respectable')
else:
    print('ugly')
    
#input.close()
#output.close()


class Point:
    def __init__(self, x_p, y_p):
        self.x = x_p
        self.y = y_p
        

points = []
sub_x = []
sub_y = []
key = False
for i in range(8):
    x, y = list(map(int, input().split()))
    if ([x, y] in points):
        key = True
    if x not in sub_x:
        sub_x.append(x)
    if y not in sub_y:
        sub_y.append(y)
    points.append([x, y])
sub_x.sort()
sub_y.sort()
if (key):
    print('ugly')
else:
    if (len(sub_x) == 3) and (len(sub_y) == 3):
        if ([sub_x[1], sub_y[1]] in points):
            print('ugly')
        else:
            print('respectable')
    else:
        print('ugly')


from collections import namedtuple

Point = namedtuple('Point', ['x', 'y'])
answers = ['respectable', 'ugly']

ps = []

for _ in range(8):
    x, y = input().split(' ')
    ps.append(Point(int(x), int(y)))

ps.sort()

def parallelline(lA, lB):
    pAA, pAB, pAC = lA
    pBA, pBB, pBC = lB
    if pAA.x == pAB.x and pAA.x == pAC.x:
        if pBA.x == pBB.x and pBA.x == pBC.x:
            if pAA.y == pBA.y and pAB.y == pBB.y and pAC.y == pBC.y:
                if pAA.y != pAB.y and pAA.y != pAC.y:
                   return True
    if pAA.y == pAB.y and pAA.y == pAC.y:
        if pBA.y == pBB.y and pBA.y == pBC.y:
            if pAA.x == pBA.x and pAB.x == pBB.x and pAC.x == pBC.x:
                if pAA.x != pAB.x and pAA.x != pAC.x:
                     return True
    return False

if parallelline((ps[0], ps[1], ps[2]), (ps[5], ps[6], ps[7])) and parallelline((ps[0], ps[3], ps[5]), (ps[2], ps[4], ps[7])):
    print(answers[0])
else:
    print(answers[1])


u=set()
v=set()
w=set()
s=set()
def work():
    nonlocal u,v
    if len(u)<3 or len(v)<3:
        return(0)
    u = sorted(list(u))
    v = sorted(list(v))
    for i in range(3):
        for j in range(3):
            if i!=1 or j!=1:
                w.add((u[i],v[j]))
    return(w == s)

for i in range(8):
    x,y = list(map(int,input().split()))
    s.add((x,y))
    u.add(x)
    v.add(y)
    
if work():
    print("respectable")
else:
    print("ugly")


inp_arr = [tuple(map(int, input().split())) for i in range(8)]
x_set = set()
y_set = set()
for x, y in inp_arr:
    x_set.add(x)
    y_set.add(y)

if len(x_set) == len(y_set) == 3:
    ugly = False
    x_sort, y_sort = sorted(x_set), sorted(y_set)
    for x in x_sort:
        for y in y_sort:
            if (x, y) != (x_sort[1], y_sort[1]) and (x, y) not in inp_arr:
                ugly = True
else:
    ugly = True
print("ugly" if ugly else "respectable")

lines = [tuple(map(int,input().split())) for i in range(8)]
x_set = set()
y_set = set()

for x, y in lines:
    x_set.add(x)
    y_set.add(y)

if len(x_set) == len(y_set) == 3:
    flag = False
    x_sort, y_sort = sorted(x_set), sorted(y_set)
    for x in x_sort:
        for y in y_sort:
            if(x, y) != (x_sort[1], y_sort[1]) and (x, y)not in lines:
                flag = True

else:
    flag = True

print("ugly" if flag else "respectable")


x = []
y = []
all = []
for i in range(8):
	xx, yy = map(int, input().split())
	x.append(xx)
	y.append(yy)
	all.append((xx, yy))
sx = set(x)
sy = set(y)
if len(sx) % 3 != 0 or len(sy) % 3 != 0:
	print('ugly')
else:
	sx = sorted(list(sx))
	sy = sorted(list(sy))
	# print(sx)
	# print(sy)
	for i in range(3):
		for j in range(3):
			if i == 1 and j == 1:
				continue
			if not (sx[i], sy[j]) in all:
				print('ugly')
				return
	print('respectable')

v = []
for i in range(0, 8):
    x, y = list(map(int, input().split()))
    v.append((x, y))

v.sort()
if v[0][0] == v[1][0] == v[2][0] and v[3][0] == v[4][0] and v[5][0] == v[6][0] == v[7][0] and v[0][1] == v[3][1] == v[5][1] and v[1][1] == v[6][1] and v[2][1] == v[4][1] == v[7][1] and v[0][0] != v[3][0] != v[7][0] and v[0][1] != v[1][1] != v[2][1]: print('respectable')
else: print('ugly')



def check():
    l = []
    for i in range(8):
        x, y = list(map(int, input().split()))
        l += [[x, y]]

    xSet = set()
    ySet = set()
    for x, y in l:
        xSet.add(x)
        ySet.add(y)

    if len(xSet) != 3 or len(ySet) != 3:
        return False

    xList = sorted(list(xSet))
    yList = sorted(list(ySet))

    z = []
    for x in xList:
        for y in yList:
            if x == xList[1] and y == yList[1]:
                pass
            else:
                z += [[x, y]]

    z.sort()
    l.sort()
    return z == l


if check():
    print("respectable")
else:
    print("ugly")


x, y = [0] * 8, [0] * 8
for i in range(8): x[i], y[i] = map(int, input().split())
for i in range(8):
    for j in range(i):
        if x[i] == x[j] and y[i] == y[j]:
            print("ugly")
            break
    else:
        continue
    break
else:        
    x.sort()
    y.sort()
    if (x[0] == x[1] == x[2] and x[3] == x[4] and x[5] == x[6] == x[7] and
        y[0] == y[1] == y[2] and y[3] == y[4] and y[5] == y[6] == y[7] and
        x[2] != x[3] and x[4] != x[5] and y[2] != x[3] and y[4] != x[5]):
        print("respectable")
    else: print("ugly")

l = [[int(c) for c in input().split()] for i in range(8)]
xs = sorted(set([p[0] for p in l]))
ys = sorted(set([p[1] for p in l]))
if len(xs) != 3 or len(ys) != 3:
    print("ugly")
else:
    done = False
    for x in range(3):
        for y in range(3):
            if x == y == 1: continue
            if [xs[x],ys[y]] not in l:
                print("ugly")
                done = True
                break
        if done: break
    if not done:
        print("respectable")

v = []

for i in range(0,8):
    x, y  = list(map(int, input().split()))
    v.append((x,y))

v.sort()

if v[0][0] == v[1][0] == v[2][0] \
    and v[3][0] == v[4][0] \
    and v[5][0] == v[6][0] == v[7][0] \
    and v[0][1] == v[3][1] == v[5][1] \
    and v[1][1] == v[6][1] \
    and v[2][1] == v[4][1] == v[7][1] \
    and v[0][0] != v[3][0] != v[7][0] \
    and v[0][1] != v[1][1] != v[2][1]: 
        print("respectable")
else : 
    print("ugly")






l = []
for i in range(8):
    x, y = [int(x) for x in input().split()]
    l.append( (x,y) )

l.sort()
lx = []
lx.append( l[0][0] )
lx.append( l[3][0] )
lx.append( l[6][0] )
ly = []
ly.append( l[0][1] )
ly.append( l[1][1] )
ly.append( l[2][1] )

eps = [(x, y) for x in lx for y in ly]
eps.pop( 4 )

if( l==eps and lx[0]!=lx[1] and lx[0]!=lx[2] and lx[1]!=lx[2]
	and ly[0]!=ly[1] and ly[0]!=ly[2] and ly[1]!=ly[2]):
    print("respectable")
else:
    print("ugly")


def solve():
    S = set()
    x = [-1] * 3
    y = [-1] * 3
    xc = [0] * 3
    yc = [0] * 3
    i = 0
    for i in range(8):
        xi, yi = list(map(int, input().split()))
        if str([xi, yi]) in S:
            return 0
        S.add(str([xi, yi]))
        j = 0
        while j < 3:
            if x[j] == -1:
                x[j] = xi
                xc[j] += 1
                break
            elif x[j] == xi:
                xc[j] += 1
                break
            j += 1
        if j == 3:
            return 0
        j = 0
        while j < 3:
            if y[j] == -1:
                y[j] = yi
                yc[j] += 1
                break
            elif y[j] == yi:
                yc[j] += 1
                break
            j += 1
        if j == 3:
            return 0
    i = 0
    while i < 3:
        if xc[i] == 2:
            x[i], x[1] = x[1], x[i]
            xc[i], xc[1] = xc[1], xc[i]
            break
        i += 1
    if i == 3:
        return 0
    if xc[0] != 3 or xc[2] != 3:
        return 0
    if x[0] > x[2]:
        x[0], x[2] = x[2], x[0]
    if x[0] > x[1] or x[1] > x[2]:
        return 0
    i = 0
    while i < 3:
        if yc[i] == 2:
            y[i], y[1] = y[1], y[i]
            yc[i], yc[1] = yc[1], yc[i]
            break
        i += 1
    if i == 3:
        return 0
    if yc[0] != 3 or yc[2] != 3:
        return 0
    if y[0] > y[2]:
        y[0], y[2] = y[2], y[0]
    if y[0] > y[1] or y[1] > y[2]:
        return 0
    return 1

if solve() == 1:
    print('respectable')
else:
    print('ugly')


l = []
for i in range(8):
    x, y = list(map(int, input().split()))
    l.append( (x, y) )

l.sort()
lx = []
lx.append( l[0][0] )
lx.append( l[3][0] )
lx.append( l[5][0] )
ly = []
ly.append( l[0][1] )
ly.append( l[1][1] )
ly.append( l[2][1] )

eps = [(x, y) for x in lx for y in ly]
eps.pop( 4 )

if l == eps and lx[0] != lx[1] and lx[0] != lx[2] and lx[1] != lx[2] and \
        ly[0] != ly[1] and ly[0] != ly[2] and ly[1] != ly[2]:
    print('respectable')
else:
    print('ugly')


pairs = []
for i in range (8):
  tmp = list (map (int, input().split()))
  pairs.append (tmp)
pairs.sort ()

def judge ():
  return (pairs[0][0] < pairs[3][0] < pairs[5][0] and
          pairs[0][1] < pairs[1][1] < pairs[2][1] and
          pairs[0][0] == pairs[1][0] == pairs[2][0] and
          pairs[3][0] == pairs[4][0] and
          pairs[5][0] == pairs[6][0] == pairs[7][0] and
          pairs[0][1] == pairs[5][1] and
          pairs[1][1] == pairs[6][1] and
          pairs[2][1] == pairs[7][1] and
          pairs[0][1] == pairs[3][1] and
          pairs[2][1] == pairs[4][1])

if judge ():
  print ('respectable')
else:
  print ('ugly')


x=[None]*10
y=[None]*10
t=[]
xc=[]
yc=[]
f=False
for i in range(8):
    x[i],y[i]=list(map(int,input().split()))
    if (x[i],y[i])in t: f=True
    t.append((x[i],y[i]))
    if not(x[i]  in xc): xc.append(x[i])
    if y[i] not in yc:yc.append(y[i])
            


if (len(xc)!=3)or(len(yc)!=3)or f: print('ugly')
else:
             yc.sort()
             xc.sort()
             if (xc[1],yc[1])in t:print('ugly')
             else: print('respectable')


def main(temp):
	nums = []
	for item in temp:
		if item not in nums:
			nums.append(item)
		else:
			return 'ugly'
	Xs = [item[0] for item in nums]
	Ys = [item[1] for item in nums]
	Xset = list(set(Xs))
	Yset = list(set(Ys))

	if len(Xset)!=3 or len(Yset)!=3:
		return 'ugly'

	Xset.sort()
	Yset.sort()

	a,b,c = Xs.count(Xset[0]), Xs.count(Xset[1]), Xs.count(Xset[2])
	q,w,e = Ys.count(Yset[0]), Ys.count(Yset[1]), Ys.count(Yset[2])

	if a==c==q==e==3 and b==w==2:
		return 'respectable'
	else:
		return 'ugly'

def init():
	nums = []
	for i in range(8):
		nums.append(list(map(int, input().split())))

	print(main(nums))

init()

t = [tuple(map(int, input().split())) for i in range(8)]
t.sort()
s = t[0][0] < t[3][0] < t[5][0] and t[0][1] < t[1][1] < t[2][1] and t[0][0] == t[1][0] == t[2][0] and t[3][0] == t[4][0] and t[5][0] == t[6][0] == t[7][0] and t[0][1] == t[3][1] == t[5][1] and t[1][1] == t[6][1] and t[2][1] == t[4][1] == t[7][1]
print(['ugly','respectable'][s]) 


ar = [tuple(map(int, input().split(' '))) for i in range(8)]
ar.sort()
print('respectable' if ar[0][0]==ar[1][0]==ar[2][0] and ar[3][0]==ar[4][0] and ar[5][0]==ar[6][0]==ar[7][0] and ar[0][1]==ar[3][1]==ar[5][1] and ar[1][1]==ar[6][1] and ar[2][1]==ar[4][1]==ar[7][1] and ar[0][0]<ar[3][0]<ar[5][0] and ar[0][1]<ar[1][1]<ar[2][1] else 'ugly')


d = [{}, {}]
t = []

for i in range(8):
    x, y = [int(x) for x in input().split()]
    if [x, y] in t:
        print("ugly")
        return
    t.append([x, y])
    if x not in d[0]:
        d[0][x] = 1
    else:
        d[0][x] += 1
    if y not in d[1]:
        d[1][y] = 1
    else:
        d[1][y] += 1

if (len(d[0]) == 3) and (len(d[1]) == 3):
    a, b = [], []
    for k in sorted(d[0]):
        a.append(d[0][k])
    for k in sorted(d[1]):
        b.append(d[1][k])
    if (a == [3, 2, 3]) and (b == [3, 2, 3]):
        print("respectable")
    else:
        print("ugly")
else:
    print("ugly")