You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.

You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered from left to right from $0$):   if the index of the plank is divisible by $r$ (such planks have indices $0$, $r$, $2r$ and so on) then you must paint it red;  if the index of the plank is divisible by $b$ (such planks have indices $0$, $b$, $2b$ and so on) then you must paint it blue;  if the index is divisible both by $r$ and $b$ you can choose the color to paint the plank;  otherwise, you don't need to paint the plank at all (and it is forbidden to spent paint on it). 

Furthermore, the Government added one additional restriction to make your punishment worse. Let's list all painted planks of the fence in ascending order: if there are $k$ consecutive planks with the same color in this list, then the Government will state that you failed the labor and execute you immediately. If you don't paint the fence according to the four aforementioned conditions, you will also be executed.

The question is: will you be able to accomplish the labor (the time is not important) or the execution is unavoidable and you need to escape at all costs.


-----Input-----

The first line contains single integer $T$ ($1 \le T \le 1000$) — the number of test cases.

The next $T$ lines contain descriptions of test cases — one per line. Each test case contains three integers $r$, $b$, $k$ ($1 \le r, b \le 10^9$, $2 \le k \le 10^9$) — the corresponding coefficients.


-----Output-----

Print $T$ words — one per line. For each test case print REBEL (case insensitive) if the execution is unavoidable or OBEY (case insensitive) otherwise.


-----Example-----
Input
4
1 1 2
2 10 4
5 2 3
3 2 2

Output
OBEY
REBEL
OBEY
OBEY

Difficulty: interview

Starter code:

Solutions:

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


def gcd(a,b):
	while b:
		a,b = b, a%b
	return a

T = inp()
for _ in range(T):
    a,b,k = inpl()
    a,b = min(a,b), max(a,b)

    n = gcd(a,b)
    # while n < b:
    #     n += a
    #     cnt += 1
    cnt = -((n-b)//a)


    if cnt >= k:
        print("REBEL")
    else:
        print("OBEY")


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

n = int(input())
for i in range(n):
    r, b, k = list(map(int, input().split()))
    if b > r:
        r, b = b, r
    r, b = r // gcd(r, b), b // gcd(r, b)
    if (r + b - 2) // b >= k:
        print("REBEL")
    else:
        print("OBEY")


from math import gcd

t = int(input())

for _ in range(t):
    r, b, k = list(map(int, input().split()))
    r, b = sorted([r, b])
    a = gcd(r, b)
    x = (b - a - 1) // r + 1
    print("REBEL" if x >= k else "OBEY")


def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)

N = int(input())
for _ in range(N):
    a, b, k = list(map(int, input().split()))
    g = gcd(a, b)
    mi = min(a, b)
    ma = max(a, b)
    A = ma//g - 1
    B = mi//g
    
    if B * (k-1) < A:
        print("REBEL")
    else:
        print("OBEY")


"""This code was written by
Russell Emerine - linguist,
mathematician, coder,
musician, and metalhead."""
from math import gcd
n = int(input())
for _ in range(n):
  r, b, k = list(map(int, input().split()))
  g = gcd(r, b)
  r //= g
  b //= g
  if (r + b - 2) // b >= k: print("REBEL")
  elif (b + r - 2) // r >= k: print("REBEL")
  else: print("OBEY")


from math import gcd

n = int(input())

for i in range(n):
    r,b,k = list(map(int,input().split()))
    if r == b:
        print('OBEY')
        continue
    if r < b:
        r,b = b,r
    # a > b
    g = gcd(r, b)
    m = 1 + (r - g - 1) // b
    if m >= k:
        print('REBEL')
    else:
        print('OBEY')


from math import ceil
def gcd(a, b):
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return a + b

t = int(input())
for kkk in range(t):
    a, b, k = map(int, input().split())
    if a == b:
        print('OBEY')
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        a, b = max(a, b), min(a, b)
        kk = (a - 1) // b + (1 if (a - 1) % b != 0 else 0)
        if kk >= k:
            print('REBEL')
        else:
            print('OBEY')

from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

OR=['OBEY','REBEL']

def gcd(x,y):
    y,x=max(x,y),min(x,y)
    if y%x==0:
        return x
    return gcd(x,y%x)
    
t=I()
for _ in range(t):
    ans=0
    r,b,k=LI()
    r,b=max(r,b),min(r,b)
    
    g=gcd(r,b)
    r,b=r//g,b//g
    
    if (r-2)//b>=k-1:
        if r==b and k==1:
            a=0
        else:
            a=1
    else:
        a=0
    print(OR[a])
    

def gcd(a,b):
    if b==0:return a
    return(gcd(b,a%b))
for i in ' '*int(input()):
    r,b,k=map(int,input().split())
    g=gcd(r,b)
    r/=g
    b/=g
    if r>b:r,b=b,r
    if r==1:
        if b>k:print('REBEL')
        else:print('OBEY')
    else:
        if r*(k-1)+1<=b-1:print('REBEL')
        else:print('OBEY')

#!/usr/bin/env python3
import sys
from fractions import gcd
input = sys.stdin.readline

t = int(input())
for i in range(t):
    r, b, k = [int(item) for item in input().split()]
    if r > b:
        r, b = b, r
    g = gcd(r, b)
    maxima = (b - g + r - 1) // r
    if maxima >= k:
        print("REBEL")
    else:
        print("OBEY")

from math import gcd
for i in range(int(input())):
    r, b, k = map(int, input().split())
    if r > b:
        r, b = b, r
    t = r * b // (gcd(r, b))
    t -= 1
    m = (t // r) // (t // b + 1)
    if (t // r) % (t // b + 1):
        m += 1
    # print(m)
    if k <= m:
        print("REBEL")
    else:
        print("OBEY")

import math

T=int(input())
for i in range(T):
  r,b,k=map(int,input().split())
  if r==b:
    print("OBEY")
    continue
  if r>b:
    tem=r
    r=b
    b=tem
  gicd = math.gcd(r,b)
  out = int(((b+r-gicd)-1)/r)
  if out >= k:
    print("REBEL")
  else:
    print("OBEY")

n = int(input())

def gcd(x,y):
    
    while x != 0 and y != 0:
        x,y = max(x,y), min(x,y)
        x %= y
    return max(x,y)

for i in range(n):

    r, b, k = list(map(int,input().split()))
    g = gcd(r, b)
    r,b = max(r,b)//g, min(r,b)//g
    if (r % b == 0 and r // b - 1 < k) or (r % b == 1 and r // b < k) or \
        (r % b > 1 and r // b + 1 < k):
        print("OBEY")
    else:
        print("REBEL")


import sys
from math import gcd


# inf = open('input.txt', 'r')
# reader = (map(int, line.split()) for line in inf)
reader = (list(map(int, s.split())) for s in sys.stdin)

t, = next(reader)
for _ in range(t):
    r, b, k = next(reader)
    if r > b:
        r, b = b, r
    g = gcd(r, b)
    seq = (b - g - 1) // r + 1
    print('OBEY' if seq < k else 'REBEL')
    
# inf.close()


import sys
input = sys.stdin.readline

t=int(input())

import math

for testcases in range(t):
    r,b,k=list(map(int,input().split()))

    x=math.gcd(r,b)
    r//=x
    b//=x

    if 1+min(r,b)*(k-1)<max(r,b):
        print("REBEL")
    else:
        print("OBEY")
    


from math import gcd
t = int(input())
for i in range(t):
    r, b, k = [int(x) for x in input().split()]
    if b > r:
        b, r = r, b
    g = gcd(r, b)
    c = (r - g - 1) // b + 1
    if (c >= k):
        print("REBEL")
    else:
        print("OBEY")


from math import gcd

T = int(input())
for i in range(T):
    r, b, k = map(int, input().split())
    if r > b:
        tmp = r
        r = b
        b = tmp
    
    g = gcd(r, b)
    r = r // g
    b = b // g
    if r*(k-1)+1<b:
        print("REBEL")
    else:
        print("OBEY")

def gcd(a: int, b: int) -> int:

    if b == 0:
        return a
    return gcd(b, a%b)

t = int(input())

for _ in range(t):
    a, b, k = map(int, input().split())
    if a > b:
        a, b = b, a
    
    gcd_ab = gcd(a, b)
    tmp = a % gcd_ab + gcd_ab
    if -(-(b-tmp) // a) < k:
        print("OBEY")
    else:
        print("REBEL")

n=int(input())
def m(x,y):
    a=max(x,y)
    b=min(x,y)
    while a != b:
        c=a%b
        a=b
        b=c
        if c == 0:
            break
    return a
for i in range(n):
    r,b,k=[int(x) for x in input().split(' ')]
    a=m(r,b)
    x=max(r,b)
    y=min(r,b)
    if (2*x) % y != 0:
        if x>=(k-1)*y+2*a:
            print('REBEL')
        else:
            print('OBEY')
    elif x % y == 0:
        if x >= (k+1)*y:
            print('REBEL')
        else:
            print('OBEY')
    else:
        if x >= k*y+a:
            print('REBEL')
        else:
            print('OBEY')


t=int(input())
import math
for _ in range(t):
	a,b,k=map(int,input().split())
	if a<b:
		a,b=b,a
	if a==b:
		p=1
	elif a%b==0:
		p=a//b-1
	else:
		q=math.gcd(a,b)
		a//=q
		b//=q
		p=math.ceil((a-1)/b)
	if p>=k:
		print("REBEL")
	else:
		print("OBEY")

t = int(input())

for i in range (t):
    r, b, k = list(map(int,input().split()))
    if r > b:
        temp = r
        r = b
        b = temp
    a = b//r
    c = b % r
    if c == 0:
        a -= 1
    if c > 0 and r % c > 0:
        a += 1
    if a >= k:
        print("REBEL")
    else:
        print("OBEY")

# https://codeforces.com/contest/1260/problem/C

from fractions import gcd
n = int(input())
for i in range(n):
    r, b, k = list(map(int, input().split()))
    _gcd = gcd(r, b)
    mn = min(r, b) / _gcd
    mx = max(r, b) / _gcd
    if (mx - 1) > mn * (k - 1):
        print("REBEL")
    else:
        print("OBEY")


def gcd(x, y):
    while y:
        (x, y) = (y, x % y)
    return x

import math


t = int(input())
for __ in range(t):
    r, b, k = list(map(int, input().split()))
    gcd_rb = gcd(r, b)
    r_n = r//gcd_rb
    b_n = b//gcd_rb
    if r_n < b_n:
        r_n, b_n = b_n, r_n
    streak = math.ceil((r_n-1)/b_n)
    if streak < k:
        print("OBEY")
    else:
        print("REBEL")


import sys
import math

n = int(input())

for i in range(n):
    r, b, k = map(int, input().split())

    if r > b:
        r, b = b, r
    
    lcm = r * b // math.gcd(r,b)
    if (b - math.gcd(r, b) - 1) // r + 1 >= k:
        print("REBEL")
    else:
        print("OBEY")

t = int(input())
def ext_gcd(p, q):
    # p * x + q * y = gcd(p,q) = g となる整数(x, y, g)を求める
    if q == 0:
        return (p, 1, 0)
    g, y, x = ext_gcd(q, p%q)
    y -= (p//q)*x
    return (g, x, y)
for _ in range(t):
    r,b,k = map(int,input().split())
    ponta = ext_gcd(r,b)[0]
    if ponta <= b-1-(k-1)*r or ponta <= r-1-(k-1)*b:
        print("REBEL")
    else:
        print("OBEY")