#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
pair<int,int> a[30005];
int ans[30005],step[30005],f[30005],l[30005],r[30004],last[30005];
int main(){
    int n,m;
    cin>>n>>m;
    for (int i=1;i<=n;i++){
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a+1,a+1+n);
    f[0]=1;
    f[1]=1;
    for (int i=2;i<=n;i++)
     f[i]=(f[i-1]+f[i-2])%m;
     int q;
     cin>>q;
     for (int i=1;i<=q;i++){
        cin>>l[i]>>r[i];
        last[i]=-1;
     }
     for (int i=1;i<=n;i++){
        int d=a[i].first%m;
        for (int j=1;j<=q;j++)
        {
            if (a[i].second<l[j]||a[i].second>r[j]) continue;
            if (a[i].first==last[j])continue;
            ans[j]=(ans[j]+f[step[j]++]*d)%m;
             last[j]=a[i].first;
         }
     }
     for (int i=1;i<=q;i++) cout<<ans[i]<<endl;
     return 0;

}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=30010;
int p;

int fi[maxn];
int f(int x) {if (x>=0) return fi[x];else return ((-x)&1)?fi[-x]:p-fi[-x];}

struct Segment_Tree
{
	int n;

	int lsize[maxn];
	int lowbit(int x) {return x&-x;}
	int Query(int x) {int res=0;while (x) res+=lsize[x],x-=lowbit(x);return res;}
	void Add(int x,int c) {while (x<=n) lsize[x]+=c,x+=lowbit(x);}

	int sum1[maxn<<2],sum2[maxn<<2];
	int size[maxn<<2];
	int tag_k[maxn<<2];

	#define ls (o<<1)
	#define rs (o<<1|1)
	#define mid ((l+r)>>1)

	void Update(int o) {sum1[o]=(sum1[ls]+sum1[rs])%p;sum2[o]=(sum2[ls]+sum2[rs])%p;size[o]=size[ls]+size[rs];}
	void Mark(int o,int k) {int x1=(sum1[o]*f(k+1)+sum2[o]*f(k))%p,x2=(sum1[o]*f(k)+sum2[o]*f(k-1))%p;sum1[o]=x1;sum2[o]=x2;tag_k[o]+=k;}

	void Push_Down(int o)
	{
		if (tag_k[o])
		{
			Mark(ls,tag_k[o]);
			Mark(rs,tag_k[o]);
			tag_k[o]=0;
		}
	}

	int Query_Size(int o,int l,int r,int a,int b)
	{
		if (a<=l && r<=b) return size[o];
		Push_Down(o);
		int res=0;
		if (a<=mid) res+=Query_Size(ls,l,mid,a,b);
		if (b> mid) res+=Query_Size(rs,mid+1,r,a,b);
		return res;
	}

	void Change_Add(int o,int l,int r,int x,int v)
	{
		if (l==r) {int w=Query(l);size[o]=1;sum1[o]=v*f(w)%p;sum2[o]=v*f(w-1)%p;return;}
		Push_Down(o);
		if (x<=mid) Change_Add(ls,l,mid,x,v);
		else Change_Add(rs,mid+1,r,x,v);
		Update(o);
	}

	void Change_Delete(int o,int l,int r,int x)
	{
		if (l==r) {size[o]=0;sum1[o]=sum2[o]=0;return;}
		Push_Down(o);
		if (x<=mid) Change_Delete(ls,l,mid,x);
		else Change_Delete(rs,mid+1,r,x);
		Update(o);
	}

	void Mark_Tagk(int o,int l,int r,int a,int b,int c)
	{
		if (a<=l && r<=b) {Mark(o,c);return;}
		Push_Down(o);
		if (a<=mid) Mark_Tagk(ls,l,mid,a,b,c);
		if (b> mid) Mark_Tagk(rs,mid+1,r,a,b,c);
		Update(o);
	}

	void Change(int x,int v,int c)
	{
		if (c==1) Change_Add(1,1,n,x,v),Add(x,1);
		else Change_Delete(1,1,n,x),Add(x,-1);
		if (x<n) Mark_Tagk(1,1,n,x+1,n,c);
	}

	int Result() {return sum1[1];}
}T;

int a[maxn],temp[maxn];
int cnt[maxn];
int ans[maxn];
int n,q,blocksize,ts;

struct Query {int l,r,block,id;bool operator< (const Query &b) const {return block<b.block || block==b.block && r<b.r;}}Q[maxn];

int main()
{
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	scanf("%d%d",&n,&p);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	memcpy(temp,a,sizeof(temp));
	sort(temp+1,temp+1+n);
	ts=unique(temp+1,temp+1+n)-(temp+1);
	for (int i=1;i<=n;i++) a[i]=lower_bound(temp+1,temp+1+ts,a[i])-temp;
	for (int i=1;i<=ts;i++) temp[i]%=p;
	T.n=ts;
	fi[1]=1;fi[2]=1;
	for (int i=3;i<=ts;i++) fi[i]=(fi[i-1]+fi[i-2])%p;
	blocksize=sqrt(n);
	scanf("%d",&q);
	for (int i=1;i<=q;i++) scanf("%d%d",&Q[i].l,&Q[i].r),Q[i].block=Q[i].l/blocksize,Q[i].id=i;
	sort(Q+1,Q+1+q);
	for (int i=1,l=1,r=0;i<=q;i++)
	{
		while (r<Q[i].r) {r++;cnt[a[r]]++;if (cnt[a[r]]==1) T.Change(a[r],temp[a[r]], 1);}
		while (r>Q[i].r) {cnt[a[r]]--;if (cnt[a[r]]==0) T.Change(a[r],temp[a[r]],-1);r--;}
		while (l>Q[i].l) {l--;cnt[a[l]]++;if (cnt[a[l]]==1) T.Change(a[l],temp[a[l]], 1);}
		while (l<Q[i].l) {cnt[a[l]]--;if (cnt[a[l]]==0) T.Change(a[l],temp[a[l]],-1);l++;}
		ans[Q[i].id]=T.Result();
	}
	for (int i=1;i<=q;i++) printf("%d\n",ans[i]);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=30010;
int p;

int fi[maxn];
inline int f(int x) {if (x>=0) return fi[x];else return ((-x)&1)?fi[-x]:p-fi[-x];}

struct Segment_Tree
{
	int sum1[maxn<<2],sum2[maxn<<2];
	int size[maxn<<2];
	int tag_k[maxn<<2];
	int n;

	#define ls (o<<1)
	#define rs (o<<1|1)
	#define mid ((l+r)>>1)

	void Update(int o) {sum1[o]=(sum1[ls]+sum1[rs])%p;sum2[o]=(sum2[ls]+sum2[rs])%p;size[o]=size[ls]+size[rs];}
	void Mark(int o,int k)
	{
		if (k==1) {int x1=sum1[o];sum1[o]+=sum2[o],sum2[o]=x1;if (sum1[o]>p) sum1[o]-=p;tag_k[o]++;return;}
		int x1=(sum1[o]*f(k+1)+sum2[o]*f(k))%p,x2=(sum1[o]*f(k)+sum2[o]*f(k-1))%p;
		sum1[o]=x1;sum2[o]=x2;tag_k[o]+=k;
	}

	void Push_Down(int o)
	{
		if (tag_k[o])
		{
			Mark(ls,tag_k[o]);
			Mark(rs,tag_k[o]);
			tag_k[o]=0;
		}
	}

	void Change(int o,int l,int r,int x,int v,int w,int c)
	{
		if (l==r)
		{
			if (c==-1) size[o]=sum1[o]=sum2[o]=0;
			else size[o]=1,sum1[o]=v*f(w+1)%p,sum2[o]=v*f(w)%p;
			return;
		}
		Push_Down(o);
		if (x<=mid) Change(ls,l,mid,x,v,w,c),Mark(rs,c);
		else Change(rs,mid+1,r,x,v,w+size[ls],c);
		Update(o);
	}

	void Change(int x,int v,int c) {Change(1,1,n,x,v,0,c);}
	int Result() {return sum1[1];}
}T;

int a[maxn],temp[maxn];
int cnt[maxn];
int ans[maxn];
int n,q,blocksize,ts;

struct Query {int l,r,block,id;bool operator< (const Query &b) const {return block<b.block || block==b.block && r<b.r;}}Q[maxn];

int main()
{
	scanf("%d%d",&n,&p);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	memcpy(temp,a,sizeof(temp));
	sort(temp+1,temp+1+n);
	ts=unique(temp+1,temp+1+n)-(temp+1);
	for (int i=1;i<=n;i++) a[i]=lower_bound(temp+1,temp+1+ts,a[i])-temp;
	for (int i=1;i<=ts;i++) temp[i]%=p;
	T.n=ts;
	fi[1]=1;fi[2]=1;
	for (int i=3;i<=ts+2;i++) fi[i]=(fi[i-1]+fi[i-2])%p;
	blocksize=sqrt(n);
	scanf("%d",&q);
	for (int i=1;i<=q;i++) scanf("%d%d",&Q[i].l,&Q[i].r),Q[i].block=Q[i].l/blocksize,Q[i].id=i;
	sort(Q+1,Q+1+q);
	for (int i=1,l=1,r=0;i<=q;i++)
	{
		while (r<Q[i].r) {r++;cnt[a[r]]++;if (cnt[a[r]]==1) T.Change(a[r],temp[a[r]], 1);}
		while (r>Q[i].r) {cnt[a[r]]--;if (cnt[a[r]]==0) T.Change(a[r],temp[a[r]],-1);r--;}
		while (l>Q[i].l) {l--;cnt[a[l]]++;if (cnt[a[l]]==1) T.Change(a[l],temp[a[l]], 1);}
		while (l<Q[i].l) {cnt[a[l]]--;if (cnt[a[l]]==0) T.Change(a[l],temp[a[l]],-1);l++;}
		ans[Q[i].id]=T.Result();
	}
	for (int i=1;i<=q;i++) printf("%d\n",ans[i]);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=30010;
int p;

int fi[maxn];
inline int f(int x) {if (x>=0) return fi[x];else return ((-x)&1)?fi[-x]:p-fi[-x];}

struct Segment_Tree
{
	int sum1[maxn<<2],sum2[maxn<<2];
	int size[maxn<<2];
	int tag_k[maxn<<2];
	int n;

	#define ls (o<<1)
	#define rs (o<<1|1)
	#define mid ((l+r)>>1)

	void Update(int o) {sum1[o]=(sum1[ls]+sum1[rs])%p;sum2[o]=(sum2[ls]+sum2[rs])%p;size[o]=size[ls]+size[rs];}
	void Mark(int o,int k)
	{
		if (k==1) {int x1=sum1[o];sum1[o]+=sum2[o],sum2[o]=x1;if (sum1[o]>p) sum1[o]-=p;tag_k[o]++;return;}
		int x1=(sum1[o]*f(k+1)+sum2[o]*f(k))%p,x2=(sum1[o]*f(k)+sum2[o]*f(k-1))%p;
		sum1[o]=x1;sum2[o]=x2;tag_k[o]+=k;
	}

	void Push_Down(int o)
	{
		if (tag_k[o])
		{
			Mark(ls,tag_k[o]);
			Mark(rs,tag_k[o]);
			tag_k[o]=0;
		}
	}

	void Change(int o,int l,int r,int x,int v,int w,int c)
	{
		if (l==r)
		{
			if (c==-1) size[o]=sum1[o]=sum2[o]=0;
			size[o]=1;sum1[o]=v*f(w)%p;sum2[o]=v*f(w-1)%p;
			return;
		}
		Push_Down(o);
		if (x<=mid) Change(ls,l,mid,x,v,w,c),Mark(rs,c);
		else Change(rs,mid+1,r,x,v,w+size[ls],c);
		Update(o);
	}

	void Change(int x,int v,int c) {Change(1,1,n,x,v,0,c);}
	int Result() {return sum1[1];}
}T;

int a[maxn],temp[maxn];
int cnt[maxn];
int ans[maxn];
int n,q,blocksize,ts;

struct Query {int l,r,block,id;bool operator< (const Query &b) const {return block<b.block || block==b.block && r<b.r;}}Q[maxn];

int main()
{
	scanf("%d%d",&n,&p);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	memcpy(temp,a,sizeof(temp));
	sort(temp+1,temp+1+n);
	ts=unique(temp+1,temp+1+n)-(temp+1);
	for (int i=1;i<=n;i++) a[i]=lower_bound(temp+1,temp+1+ts,a[i])-temp;
	for (int i=1;i<=ts;i++) temp[i]%=p;
	T.n=ts;
	fi[1]=1;fi[2]=1;
	for (int i=3;i<=ts+2;i++) fi[i]=(fi[i-1]+fi[i-2])%p;
	blocksize=sqrt(n);
	scanf("%d",&q);
	for (int i=1;i<=q;i++) scanf("%d%d",&Q[i].l,&Q[i].r),Q[i].block=Q[i].l/blocksize,Q[i].id=i;
	sort(Q+1,Q+1+q);
	for (int i=1,l=1,r=0;i<=q;i++)
	{
		while (r<Q[i].r) {r++;cnt[a[r]]++;if (cnt[a[r]]==1) T.Change(a[r],temp[a[r]], 1);}
		while (r>Q[i].r) {cnt[a[r]]--;if (cnt[a[r]]==0) T.Change(a[r],temp[a[r]],-1);r--;}
		while (l>Q[i].l) {l--;cnt[a[l]]++;if (cnt[a[l]]==1) T.Change(a[l],temp[a[l]], 1);}
		while (l<Q[i].l) {cnt[a[l]]--;if (cnt[a[l]]==0) T.Change(a[l],temp[a[l]],-1);l++;}
		ans[Q[i].id]=T.Result();
	}
	for (int i=1;i<=q;i++) printf("%d\n",ans[i]);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=30010;
int p;

int fi[maxn];
int f(int x) {if (x>=0) return fi[x];else return ((-x)&1)?fi[-x]:p-fi[-x];}

struct Segment_Tree
{
	int sum1[maxn<<2],sum2[maxn<<2];
	int size[maxn<<2];
	int tag_k[maxn<<2];
	int n;

	#define ls (o<<1)
	#define rs (o<<1|1)
	#define mid ((l+r)>>1)

	void Update(int o) {sum1[o]=(sum1[ls]+sum1[rs])%p;sum2[o]=(sum2[ls]+sum2[rs])%p;size[o]=size[ls]+size[rs];}
	void Mark(int o,int k) {int x1=(sum1[o]*f(k+1)+sum2[o]*f(k))%p,x2=(sum1[o]*f(k)+sum2[o]*f(k-1))%p;sum1[o]=x1;sum2[o]=x2;tag_k[o]+=k;return;}

	void Push_Down(int o)
	{
		if (tag_k[o])
		{
			Mark(ls,tag_k[o]);
			Mark(rs,tag_k[o]);
			tag_k[o]=0;
		}
	}

	int Query_Size(int o,int l,int r,int a,int b)
	{
		if (a<=l && r<=b) return size[o];
		Push_Down(o);
		int res=0;
		if (a<=mid) res+=Query_Size(ls,l,mid,a,b);
		if (b> mid) res+=Query_Size(rs,mid+1,r,a,b);
		return res;
	}

	void Change_Add(int o,int l,int r,int x,int v,int w)
	{
		if (l==r) {size[o]=1;sum1[o]=v*f(w)%p;sum2[o]=v*f(w-1)%p;return;}
		Push_Down(o);
		if (x<=mid) Change_Add(ls,l,mid,x,v,w);
		else Change_Add(rs,mid+1,r,x,v,w);
		Update(o);
	}

	void Change_Delete(int o,int l,int r,int x)
	{
		if (l==r) {size[o]=0;sum1[o]=sum2[o]=0;return;}
		Push_Down(o);
		if (x<=mid) Change_Delete(ls,l,mid,x);
		else Change_Delete(rs,mid+1,r,x);
		Update(o);
	}

	void Mark_Tagk(int o,int l,int r,int a,int b,int c)
	{
		if (a<=l && r<=b) {Mark(o,c);return;}
		Push_Down(o);
		if (a<=mid) Mark_Tagk(ls,l,mid,a,b,c);
		if (b> mid) Mark_Tagk(rs,mid+1,r,a,b,c);
		Update(o);
	}

	void Change(int x,int v,int c)
	{
		if (c==1) Change_Add(1,1,n,x,v,(x==1)?1:Query_Size(1,1,n,1,x-1)+1);
		else Change_Delete(1,1,n,x);
		if (x<n) Mark_Tagk(1,1,n,x+1,n,c);
	}

	int Result() {return sum1[1];}
}T;

int a[maxn],temp[maxn];
int cnt[maxn];
int ans[maxn];
int n,q,blocksize,ts;

struct Query {int l,r,block,id;bool operator< (const Query &b) const {return block<b.block || block==b.block && r<b.r;}}Q[maxn];

int main()
{
	scanf("%d%d",&n,&p);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	memcpy(temp,a,sizeof(temp));
	sort(temp+1,temp+1+n);
	ts=unique(temp+1,temp+1+n)-(temp+1);
	for (int i=1;i<=n;i++) a[i]=lower_bound(temp+1,temp+1+ts,a[i])-temp;
	for (int i=1;i<=ts;i++) temp[i]%=p;
	T.n=ts;
	fi[1]=1;fi[2]=1;
	for (int i=3;i<=ts;i++) fi[i]=(fi[i-1]+fi[i-2])%p;
	blocksize=sqrt(n)+1;
	scanf("%d",&q);
	for (int i=1;i<=q;i++) scanf("%d%d",&Q[i].l,&Q[i].r),Q[i].block=Q[i].l/blocksize,Q[i].id=i;
	sort(Q+1,Q+1+q);
	for (int i=1,l=1,r=0;i<=q;i++)
	{
		while (r<Q[i].r) {r++;cnt[a[r]]++;if (cnt[a[r]]==1) T.Change(a[r],temp[a[r]], 1);}
		while (r>Q[i].r) {cnt[a[r]]--;if (cnt[a[r]]==0) T.Change(a[r],temp[a[r]],-1);r--;}
		while (l>Q[i].l) {l--;cnt[a[l]]++;if (cnt[a[l]]==1) T.Change(a[l],temp[a[l]], 1);}
		while (l<Q[i].l) {cnt[a[l]]--;if (cnt[a[l]]==0) T.Change(a[l],temp[a[l]],-1);l++;}
		ans[Q[i].id]=T.Result();
	}
	for (int i=1;i<=q;i++) printf("%d\n",ans[i]);
	return 0;
}


#include<bits/stdc++.h>
#define N 30005
using namespace std;
struct data{
	int l,r,id,s;
	int operator < (const data &b)const{
		return s!=b.s?s<b.s:r<b.r;
  }
}Q[N];int n,m,sign,P,i,L,R,S;
int have[N<<2],w[N],b[N],U[N],pos[N],num[N],ans[N];
struct matrix{
	int p[2][2];
	inline matrix operator * (const matrix &b)const{
		matrix c;
		for (int i=0;i<2;i++)
			for (int j=0;j<2;j++){
				c.p[i][j]=0;
				for (int k=0;k<2;k++)
					c.p[i][j]+=p[i][k]*b.p[k][j];
				c.p[i][j]%=P;
		  }return c;
	}inline void operator += (const matrix &b){
		for (int i=0;i<2;i++)
			for (int j=0;j<2;j++)
				if ((p[i][j]+=b.p[i][j])>=P) p[i][j]-=P;
	}
}a[N<<2],Pow[N];
void Insert(int x,int l,int r,int pos){
	if (l==r){
		a[x].p[0][0]=a[x].p[0][1]=a[x].p[1][0]=sign*w[l];
		have[x]=sign;return;
  }int mid=(l+r)>>1;
  if (pos<=mid) Insert(x<<1,l,mid,pos);
  				else  Insert(x<<1|1,mid+1,r,pos);
  have[x]=have[x<<1]+have[x<<1|1];
  a[x]=a[x<<1];a[x]+=a[x<<1|1]*Pow[have[x<<1]];
}
int main(){
	scanf("%d%d",&n,&P);
	for (i=1;i<=n;i++)
		scanf("%d",&U[i]),b[i]=U[i];
	sort(U+1,U+n+1);
	*U=unique(U+1,U+n+1)-(U+1);
	for (i=1;i<=n;i++)
		w[pos[i]=lower_bound(U+1,U+*U+1,b[i])-U]=b[i]%P;
	Pow[0].p[0][0]=Pow[0].p[1][1]=1;
	Pow[1].p[0][0]=Pow[1].p[0][1]=Pow[1].p[1][0]=1;
	for (i=2;i<=n;i++)
		Pow[i]=Pow[i-1]*Pow[1];
	S=sqrt(n);
	scanf("%d",&m);
	for (i=1;i<=m;i++)
		scanf("%d%d",&Q[i].l,&Q[i].r),
		Q[i].id=i,Q[i].s=Q[i].l/S;
	sort(Q+1,Q+m+1);
	L=1;R=0;
	for (i=1;i<=m;i++){
		sign=1;
		for (;R<Q[i].r;)
			if ((++num[pos[++R]])==1) Insert(1,1,n,pos[R]);
		for (;L>Q[i].l;)
			if ((++num[pos[--L]])==1) Insert(1,1,n,pos[L]);
		sign=0;
		for (;R>Q[i].r;R--)
			if ((--num[pos[R]])==0) Insert(1,1,n,pos[R]);
		for (;L<Q[i].l;L++)
			if ((--num[pos[L]])==0) Insert(1,1,n,pos[L]);
		ans[Q[i].id]=a[1].p[0][1];
  }for (i=1;i<=m;i++)
  	printf("%d\n",ans[i]);
}


#include<bits/stdc++.h>
#define N 30005
using namespace std;
struct data{
	int l,r,id,s;
	int operator < (const data &b)const{
		return s!=b.s?s<b.s:r<b.r;
  }
}Q[N];int n,m,sign,P,i,L,R,S;
int have[N<<2],w[N],b[N],U[N],pos[N],num[N],ans[N];
struct matrix{
	int p[2][2];
	inline matrix operator * (const matrix &b)const{
		matrix c;
		for (int i=0;i<2;i++)
			for (int j=0;j<2;j++){
				c.p[i][j]=0;
				for (int k=0;k<2;k++)
					c.p[i][j]+=p[i][k]*b.p[k][j];
				c.p[i][j]%=P;
		  }return c;
	}inline void operator += (const matrix &b){
		for (int i=0;i<2;i++)
			for (int j=0;j<2;j++)
				if ((p[i][j]+=b.p[i][j])>=P) p[i][j]-=P;
	}
}a[N<<2],Pow[N];
void Insert(int x,int l,int r,int pos){
	if (l==r){
		a[x].p[0][0]=a[x].p[0][1]=a[x].p[1][0]=sign*w[l];
		have[x]=sign;return;
  }int mid=(l+r)>>1;
  if (pos<=mid) Insert(x<<1,l,mid,pos);
  				else  Insert(x<<1|1,mid+1,r,pos);
  have[x]=have[x<<1]+have[x<<1|1];
  a[x]=a[x<<1];a[x]+=a[x<<1|1]*Pow[have[x<<1|1]];
}
int main(){
	scanf("%d%d",&n,&P);
	for (i=1;i<=n;i++)
		scanf("%d",&U[i]),b[i]=U[i];
	sort(U+1,U+n+1);
	*U=unique(U+1,U+n+1)-(U+1);
	for (i=1;i<=n;i++)
		w[pos[i]=lower_bound(U+1,U+*U+1,b[i])-U]=b[i]%P;
	Pow[0].p[0][0]=Pow[0].p[1][1]=1;
	Pow[1].p[0][0]=Pow[1].p[0][1]=Pow[1].p[1][0]=1;
	for (i=2;i<=n;i++)
		Pow[i]=Pow[i-1]*Pow[1];
	S=sqrt(n);
	scanf("%d",&m);
	for (i=1;i<=m;i++)
		scanf("%d%d",&Q[i].l,&Q[i].r),
		Q[i].id=i,Q[i].s=Q[i].l/S;
	sort(Q+1,Q+m+1);
	L=1;R=0;
	for (i=1;i<=m;i++){
		sign=1;
		for (;R<Q[i].r;)
			if ((++num[pos[++R]])==1) Insert(1,1,n,pos[R]);
		for (;L>Q[i].l;)
			if ((++num[pos[--L]])==1) Insert(1,1,n,pos[L]);
		sign=0;
		for (;R>Q[i].r;R--)
			if ((--num[pos[R]])==0) Insert(1,1,n,pos[R]);
		for (;L<Q[i].l;L++)
			if ((--num[pos[L]])==0) Insert(1,1,n,pos[L]);
		ans[Q[i].id]=a[1].p[0][1];
  }for (i=1;i<=m;i++)
  	printf("%d\n",ans[i]);
}


#include <bits/stdc++.h>
using namespace std;

const int N = 100010;

struct Node
{
	int x;
	int id;
};

Node node[N];
int n, mod;
int m;
int fi[N];
int maxx[N];
int cnt[N];
int l[N];
int r[N];
int ans[N];

bool cmp(Node a, Node b)
{
	return a.x < b.x;
}

int main()
{
    while(scanf("%d%d", &n, &mod) == 2){
    	fi[0] = 1;
    	fi[1] = 1;
    	memset(cnt, 0, sizeof(cnt));
    	memset(ans, 0, sizeof(ans));
    	for(int i = 2; i <= n; i ++){
    		fi[i] = (fi[i - 1] + fi[i - 2]) % mod;
    	}
    	for(int i = 1; i <= n; i ++){
    		scanf("%d", &node[i].x);
    		node[i].id = i;
    	}
    	sort(node + 1, node + 1 + n, cmp);
    	scanf("%d", &m);
    	for(int i = 1; i <= m; i ++){
    		scanf("%d%d", &l[i], &r[i]);
    		maxx[i] = -1;
    	}
    	for(int i = 1; i <= n; i ++){
    		int t = node[i].x;

    		for(int j = 1; j <= m; j ++){
    			if(l[j] > node[i].id || r[j] < node[i].id){
    				continue;
    			}
    			if(maxx[j] == t){
    				continue;
    			}
    			ans[j] = (ans[j] + fi[cnt[j]] * t % mod) % mod;
    			cnt[j] ++;
    			maxx[j] = t;
    		}
    	}
    	for(int i = 1; i <= m; i ++){
    		printf("%d\n", ans[i] % mod);
    	}
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 100010;

struct Node
{
	int x;
	int id;
};

Node node[N];
int n, mod;
int m;
int fi[N];
int maxx[N];
int cnt[N];
int l[N];
int r[N];
int ans[N];

bool cmp(Node a, Node b)
{
	return a.x < b.x;
}

int main()
{
    while(scanf("%d%d", &n, &mod) == 2){
    	fi[0] = 1;
    	fi[1] = 1;
    	memset(cnt, 0, sizeof(cnt));
    	memset(ans, 0, sizeof(ans));
    	for(int i = 2; i <= n; i ++){
    		fi[i] = (fi[i - 1] + fi[i - 2]) % mod;
    	}
    	for(int i = 1; i <= n; i ++){
    		scanf("%d", &node[i].x);
    		node[i].id = i;
    	}
    	sort(node + 1, node + 1 + n, cmp);
    	scanf("%d", &m);
    	for(int i = 1; i <= m; i ++){
    		scanf("%d%d", &l[i], &r[i]);
    		maxx[i] = -1;
    	}
    	for(int i = 1; i <= n; i ++){
    		int t = node[i].x % mod;

    		for(int j = 1; j <= m; j ++){
    			if(l[j] > node[i].id || r[j] < node[i].id){
    				continue;
    			}
    			if(maxx[j] == node[i].x){
    				continue;
    			}
    			ans[j] = (ans[j] + fi[cnt[j]] * t % mod) % mod;
    			cnt[j] ++;
    			maxx[j] = node[i].x;
    		}
    	}
    	for(int i = 1; i <= m; i ++){
    		printf("%d\n", ans[i] % mod);
    	}
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 3e4+5;
pair<int,int> a[maxn];
int ans[maxn],step[maxn],f[maxn],l[maxn],r[maxn],last[maxn];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i].first),a[i].second=i;
    sort(a+1,a+1+n);
    f[0]=1,f[1]=1;
    for(int i=2;i<=n;i++)
        f[i]=(f[i-1]+f[i-2])%m;
    int q;scanf("%d",&q);
    for(int i=1;i<=q;i++)
    {
        scanf("%d%d",&l[i],&r[i]);
        last[i]=-1;
    }
    for(int i=1;i<=n;i++)
    {
        int d = a[i].first % m;
        for(int j=1;j<=q;j++)
        {
            if(a[i].second<l[j]||a[i].second>r[j])continue;
            if(a[i].first==last[j])continue;
            ans[j]=(ans[j]+f[step[j]++]*d)%m;
            last[j]=a[i].first;
        }
    }
    for(int i=1;i<=q;i++)
        printf("%d\n",ans[i]);
}


#include <bits/stdc++.h>
using namespace std;

const int N = 100010;

struct Node
{
	int x;
	int id;
};

Node node[N];
int n, mod;
int m;
int fi[N];
int maxx[N];
int cnt[N];
int l[N];
int r[N];
int ans[N];

bool cmp(Node a, Node b)
{
	return a.x < b.x;
}

int main()
{
    while(scanf("%d%d", &n, &mod) == 2){
    	fi[0] = 1;
    	fi[1] = 1;
    	memset(cnt, 0, sizeof(cnt));
    	memset(ans, 0, sizeof(ans));
    	for(int i = 2; i <= n; i ++){
    		fi[i] = (fi[i - 1] + fi[i - 2]) % mod;
    	}
    	for(int i = 1; i <= n; i ++){
    		scanf("%d", &node[i].x);
    		node[i].id = i;
    	}
    	sort(node + 1, node + 1 + n, cmp);
    	scanf("%d", &m);
    	for(int i = 1; i <= m; i ++){
    		scanf("%d%d", &l[i], &r[i]);
    		maxx[i] = -1;
    	}
    	for(int i = 1; i <= n; i ++){
    		int t = node[i].x % mod;

    		for(int j = 1; j <= m; j ++){
    			if(l[j] > node[i].id || r[j] < node[i].id){
    				continue;
    			}
    			if(maxx[j] == t){
    				continue;
    			}
    			ans[j] = (ans[j] + fi[cnt[j]] * t % mod) % mod;
    			cnt[j] ++;
    			maxx[j] = t;
    		}
    	}
    	for(int i = 1; i <= m; i ++){
    		printf("%d\n", ans[i] % mod);
    	}
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(c1>=k)
  {
      return false;
  }

  ll r2=(2*r1);

  ll c=((r2-1)/b1);
  c-=(r1/b1);

  if(c>=k)
  {
      return false;
  }
  else
  {
      return true;
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(k>c1)
  {
      return true;
  }

  if(k<=c1)
  {
      ll g=__gcd(r1,b1);

      if(g<b1)
      {
          return true;
      }
      else
      {
          return false;
      }
  }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(k>c1)
  {
      return true;
  }

  if(k<c1)
  {
      return false;
  }

  if(k==c1)
  {
      ll g=__gcd(r1,b1);

      if(g<b1)
      {
          return true;
      }
      else
      {
          return false;
      }
  }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"
#define mp make_pair
#define pb push_back

/*
ll maxn=100010;

ll fact[100010];
ll invfact[100010];

ll pow(ll a,ll n,ll m)
{
    ll res=1;

    while(n){

        if(n%2)
        {
            res=(((res%m)*(a%m))%m);
        }

        a=(((a%m)*(a%m))%m);
        n/=2;
    }

    return (res%m);
}

void cal_fact()
{
    fact[0]=1;

    for(ll i=1; i<=100005; i++)
    {
        fact[i]=(((i%mod)*(fact[i-1]%mod))%mod);
    }

    invfact[0]=1;

    for(ll i=1; i<=100005; i++)
    {
        invfact[i]=((((invfact[i-1])%mod)*pow(i,mod-2,mod))%mod);
    }
}

ll comb(ll n,ll r)
{
    ll ans=fact[n];
       ans=(((ans%mod)*(invfact[r]%mod))%mod);
       ans=(((ans%mod)*(invfact[n-r]%mod))%mod);

      return ans;
}

*/

void ob()
{
    cout<<"OBEY"<<endl;

}

void reb()
{
    cout<<"REBEL"<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //cal_fact();

    ll t=1;
    cin>>t;

    while(t--)
    {

        ll r,b,k;
        cin>>r>>b>>k;

        if(r==b)
        {
            ob();
            continue;
        }

        ll mi=min(r,b);
        ll ma=max(r,b);

        ll yu=((ma-2)/(mi));

        if(yu>=k-1)
        {
            reb();
            continue;
        }
        else
        {
            ob();
            continue;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll r2=(2*r1);

  ll c=((r2-1)/b1);
  c-=(r1/b1);

  if(c>=k)
  {
      return false;
  }
  else
  {
      return true;
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(c1>=k)
  {
      return false;
  }
  else
  {
      return true;
  }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(k>c1)
  {
      return true;
  }

  if(k<=c1)
  {
      ll g=__gcd(r1,b1);

      if(g==1)
      {
          return true;
      }
      else
      {
          return false;
      }
  }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(k>c1)
  {
      return true;
  }

  if(k<c1)
  {
      return false;
  }

  if(k==c1)
  {
      ll g=__gcd(r1,b1);

      if(g==1)
      {
          return true;
      }
      else
      {
          return false;
      }
  }

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"

ll r,b,k;

bool solve()
{
  if(r==b)
  {
      return true;
  }

  ll r1=max(r,b);
  ll b1=min(r,b);

  ll c1=((r1-1)/b1);

  if(c1==k)
  {
      return false;
  }

  ll r2=(2*r1);

  ll c=((r2-1)/b1);
  c-=(r1/b1);

  if(c==k)
  {
      return false;
  }
  else
  {
      return true;
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    cin>>t;

    while(t--)
    {
         cin>>r>>b>>k;

         if(solve())
         {
             cout<<"OBEY"<<endl;
         }
         else
         {
             cout<<"REBEL"<<endl;
         }

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define endl "\n"
#define mp make_pair
#define pb push_back

/*
ll maxn=100010;

ll fact[100010];
ll invfact[100010];

ll pow(ll a,ll n,ll m)
{
    ll res=1;

    while(n){

        if(n%2)
        {
            res=(((res%m)*(a%m))%m);
        }

        a=(((a%m)*(a%m))%m);
        n/=2;
    }

    return (res%m);
}

void cal_fact()
{
    fact[0]=1;

    for(ll i=1; i<=100005; i++)
    {
        fact[i]=(((i%mod)*(fact[i-1]%mod))%mod);
    }

    invfact[0]=1;

    for(ll i=1; i<=100005; i++)
    {
        invfact[i]=((((invfact[i-1])%mod)*pow(i,mod-2,mod))%mod);
    }
}

ll comb(ll n,ll r)
{
    ll ans=fact[n];
       ans=(((ans%mod)*(invfact[r]%mod))%mod);
       ans=(((ans%mod)*(invfact[n-r]%mod))%mod);

      return ans;
}

*/

void ob()
{
    cout<<"OBEY"<<endl;

}

void reb()
{
    cout<<"REBEL"<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //cal_fact();

    ll t=1;
    cin>>t;

    while(t--)
    {

        ll r,b,k;
        cin>>r>>b>>k;

        if(r==b)
        {
            ob();
            continue;
        }

        ll mi=min(r,b);
        ll ma=max(r,b);

        ll g=__gcd(r,b);

        ll yu=((ma-(g+1))/(mi));

        if(yu>=k-1)
        {
            reb();
            continue;
        }
        else
        {
            ob();
            continue;
        }

    }

    return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);

    ll x = (b-1)/r;
//    x++;
    if(x==k)    puts("REBEL");
    else puts("OBEY");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    ll p = b/r;
    ll q = r/b;
    if(p>=k || q>=k){
        puts("REBEL");
    }
    else puts("OBEY");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);

    ll x = (b-1)/r;
//    x++;
    if(x>=k)    puts("REBEL");
    else puts("OBEY");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

ll nxt(ll a,ll b){
    ll x = b/a+1;
    return x*a;
}

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);
    /*
    if(r==1){
        puts("obey");
        continue;
    }
    */
    ll p = nxt(r,b);
    ll q = (2*b-1)/r - (p-1)/r;

    if(q>=k)  puts("rebel");
    else puts("obey");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);
    if(r==1){
        puts("obey");
        continue;
    }
    ll x = (b-1)/r;
    if(x%k==0)  puts("rebel");
    else puts("obey");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);

    ll x = b/r;
    if(b%r==0)  x--;
//    x++;
//    cout<<x<<endl;
    if(x==k || (x>k && x%k==0) )    puts("REBEL");
    else puts("OBEY");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

ll nxt(ll a,ll b){
    ll x = b/a+1;
    return x*a;
}

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);
    if(r==1){
        puts("obey");
        continue;
    }
    ll p = nxt(r,b);
    ll q = (2*b-1)/r - (p-1)/r;

    if(q>=k)  puts("rebel");
    else puts("obey");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

ll nxt(ll a,ll b){
    ll x = b/a+1;
    return x*a;
}

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);

    ll g = __gcd(r,b);

    ll rem = b-g-1;
    ll x = 1+rem/r;
    if(x>=k)    puts("rebel");
    else    puts("obey");
}

return 0;
}


#include                <bits/stdc++.h>
#define ff              first
#define ss              second
#define pb(x)           emplace_back(x)
#define dbg(a)          cout<< #a <<" --> "<<(a)<<endl;
#define read            freopen("tst.txt","r",stdin)
#define write           freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> PP;

main(){
//read;
int t;
cin>>t;
while(t--){
    ll r,b,k;
    cin>>r>>b>>k;
    if(r>b) swap(r,b);

    ll x = b/r;
    if(b%r==0)  x--;
//    x++;
    if(x>=k)    puts("REBEL");
    else puts("OBEY");
}

return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        lli mx=max(r,b);
        lli mn=min(r,b);
        if( ((mx-1)/mn)<k || mx==mn)
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        r/=gcd(r,b);
        b/=gcd(r,b);
        lli mx=max(r,b);
        lli mn=min(r,b);
        if( ((mx-1)/mn)<k-1 )
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long li;

li a, b, k;

inline bool read() {
	if(!(cin >> a >> b >> k))
		return false;
	return true;
}

inline void solve() {
	li g = __gcd(a, b);
	a /= g;
	b /= g;
	if(a > b)
		swap(a, b);
	if((k - 1) * a + 1 < b)
		cout << "REBEL";
	else
		cout << "OBEY";
	cout << endl;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	int tc; cin >> tc;
	while(tc--) {
		read();
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        lli mx=max(r,b);
        lli mn=min(r,b);
        if(mx/mn>=k)
        {
            cout<<"REBEL"<<"\n";
        }
        else
        {
            cout<<"OBEY"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        lli mx=max(r,b);
        lli mn=min(r,b);
        if( (mx/mn)<k || mx==mn)
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        lli mx=max(r,b);
        lli mn=min(r,b);
        if(k>=mx )
        {
            cout<<"OBEY"<<"\n";
            continue;
        }
        if( ((mx-1)/mn)<k )
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        lli mx=max(r,b)/gcd(r,b);
        lli mn=min(r,b)/gcd(r,b);
        if( ((mx-1)/mn)<k )
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX 300005

lli max(lli a,lli b)
{
   if(a>b)
   {
       return a;
   }
   return b;
}
lli gcd(lli a,lli b)
{
    if(a==0)
    {
        return b;
    }
    return gcd(b%a,a);
}
lli min(lli a,lli b)
{
   if(a<b)
   {
       return a;
   }
   return b;
}
lli power(lli x,lli n)
{
    lli res=1;
    while(n>0)
    {
        if(n%2==1)
        {
            res=(res*x);
        }
        x=(x*x);
        n=n/2;
    }
    return  res;
}

lli factorialNumInverse[1000001];
lli naturalNumInverse[1000001];
lli fact[1000001];

void InverseofNumber(lli n,lli p)
{
    naturalNumInverse[0] = naturalNumInverse[1] = 1;
    for (lli i = 2; i <= n; i++)
        naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(lli n,lli p)
{
    factorialNumInverse[0] = factorialNumInverse[1] = 1;

    for (lli i = 2; i <= n; i++)
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(lli n,lli p)
{
    fact[0] = 1;
    for (lli i = 1; i <= n; i++) {
        fact[i] = (fact[i - 1] * i) % p;
    }
}
lli nCrModp(lli n, lli r, lli p)
{
    lli ans = ((fact[n] * factorialNumInverse[r]) % p * factorialNumInverse[n - r]) % p;
    return ans;
}
lli ctr;
lli primeFactors(lli n)
{
    lli res=1;
    while (n % 2 == 0)
    {
        res*=2;
        n = n/2;
    }
    for (lli i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ctr++;
            n = n/i;
        }
    }
    if (n > 2)
    {
        ctr++;
    }
   return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lli tc;
    cin>>tc;
    factorial(200005,mod);
    InverseofNumber(200005,mod);
    InverseofFactorial(200005,mod);
    while(tc--)
    {
        lli r,b,k;
        cin>>r>>b>>k;
        r/=gcd(r,b);
        b/=gcd(r,b);
        lli mx=max(r,b);
        lli mn=min(r,b);
        if( ((mx-1)/mn)<k )
        {
            cout<<"OBEY"<<"\n";
        }
        else
        {
            cout<<"REBEL"<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(y%x!=0){
            o++;
        }
        if(o>k){
            cout<<"REBEL"<<endl;
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(o>=k){
            if(o>k)
            cout<<"REBEL"<<endl;
            else{
                if(y%x==0){
                    cout<<"OBEY"<<endl;
                }
                else{
                    cout<<"REBEL"<<endl;
                }
            }
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long t;
int main()
{
    scanf("%lld",&t);
    while(t){
        t--;
        long long r,b,k;
        scanf("%lld",&r);
        scanf("%lld",&b);
        scanf("%lld",&k);
        long long x=min(r,b);
        long long y=max(b,r);
                long long o=y/x;
        if(y%x!=0){
            o++;
        }
        if(o>k){
            cout<<"REBEL"<<endl;
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(o>=k){
            cout<<"REBEL"<<endl;
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(y%x==0){
            o--;
        }
        if(o>=k){
            cout<<"REBEL"<<endl;
        }
        else{
                if(2*x-1>y&&k==2){
                    cout<<"REBEL"<<endl;
                }
                else{
            cout<<"OBEY"<<endl;
                }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(y%x==0){
            o--;
        }
        cout<<o<<endl;
        if(o>=k){
            cout<<"REBEL"<<endl;
        }
        else{
                if(2*x-1>y&&k==2){
                    cout<<"REBEL"<<endl;
                }
                else{
            cout<<"OBEY"<<endl;
                }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
       int br=1;
        while(x*br<y){
            br++;
        }
        if(br>k){
            cout<<"REBEL"<<endl;
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int r,b,k;
        scanf("%d",&r);
        scanf("%d",&b);
        scanf("%d",&k);
        int x=min(r,b);
        int y=max(b,r);
        int o=y/x;
        if(o>k){
            cout<<"REBEL"<<endl;
        }
        else{
            cout<<"OBEY"<<endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long t;
long long gcd(long long a,long long b){
    if(b==0){
        return a;
    }
    return gcd(b,a%b);
}
int main()
{
    scanf("%lldd",&t);
    while(t){
        t--;
        long long l,r,k;
        scanf("%lldd",&l);
        scanf("%lldd",&r);
        scanf("%lldd",&k);
        long long a=max(l,r);
        long long b=min(l,r);
        long long g=gcd(a,b);
        a/=g;
        b/=g;

        if((k-1)*b+1<a){
            cout<<"REBEL"<<endl;
        }
        else{
        cout<<"OBEY"<<endl;
        }

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int t;
int gcd(int a,int b){
    if(b==0){
        return a;
    }
    return gcd(b,a%b);
}
int main()
{
    scanf("%d",&t);
    while(t){
        t--;
        int l,r,k;
        scanf("%d",&l);
        scanf("%d",&r);
        scanf("%d",&k);
        int a=max(l,r);
        int b=min(l,r);
        int g=gcd(a,b);
        a/=g;
        b/=g;

        if((k-1)*b+1<a){
            cout<<"REBEL"<<endl;
        }
        else{
        cout<<"OBEY"<<endl;
        }

    }
    return 0;
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int cases;
	cin >> cases;
	while( cases-- ) {
		int a, b, k;
		cin >> a >> b >> k;
		if( a > b ) swap(a, b);
		int gcd = __gcd(a, b);
		if( a == 1 ) {
			cout << "OBEY\n";
			continue;
		}
		a /= gcd;
		b /= gcd;
		int have = b / a - 1;
		if( have >= k ) cout << "REBEL\n";
		else            cout << "OBEY\n";
	}
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int cases;
    cin >> cases;
    while( cases-- ) {
        ll r, b, k;
        cin >> r >> b >> k;
        if( r > b ) swap(r, b);
        bool flg = false;
        auto cntMlt = [](ll a, ll b, ll x) {
            ll ret = b / x - max(0LL, a - 1) / x;
            return ret;
        };
        flg |= (cntMlt(r, b - 1, r) >= k);
        ll x = b / r + (b % r != 0);
        flg |= (cntMlt(b, r * x, b) >= k);
        cout << (flg ? "REBEL\n" : "OBEY\n");
    }
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	using ll = long long;
	auto cnt = [](ll a, ll b, ll x) {
		ll ret = b / x;
		ret -= (max(0LL, a - 1) / x);
		return ret;
	};
	int cases;
	cin >> cases;
	while( cases-- ) {
		ll a, b, k;
		cin >> a >> b >> k;
		if( a > b ) swap(a, b);
		if( a == b ) {
			cout << "OBEY\n";
			continue;
		}
		ll c = cnt( a, b - 1, a );
		if( c >= k ) cout << "REBEL\n";
		else cout << "OBEY\n";
	}
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int cases;
	cin >> cases;
	while( cases-- ) {
		int a, b, k;
		cin >> a >> b >> k;
		int gcd = __gcd(a, b);
		a /= gcd;
		b /= gcd;
		if( a > b ) swap(a, b);
		int have = b / a;
		if( have >= k ) cout << "REBEL\n";
		else           cout << "OBEY\n";
	}
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int cases, i = 0;
    cin >> cases;
    while( cases-- ) {
        ll r, b, k;
        cin >> r >> b >> k;
        if( r > b ) swap(r, b);
        ll gcd = __gcd(r, b);
        bool flg = false;
        auto cntMlt = [](ll a, ll b, ll x) {
            ll ret = b / x - max(0LL, a - 1) / x;
            return ret;
        };
        flg |= (cntMlt(r, b - 1, r) >= k);
        ll x = b / gcd + (b % gcd != 0);
        flg |= (cntMlt(b, gcd * x, b) >= k);
        if( ++i == 1000 ) cout << r << " " << b << "\n";
        cout << (flg ? "REBEL\n" : "OBEY\n");
    }
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int cases;
	cin >> cases;
	while( cases-- ) {
		int a, b, k;
		cin >> a >> b >> k;
		if( a > b ) swap(a, b);
		int gcd = __gcd(a, b);
		if( a == 1 ) {
			if( k >= b ) cout << "OBEY\n";
			else         cout << "REBEL\n";
			continue;
		}
		int x = b / a - (b % a == 0);
		if( x >= k ) cout << "REBEL\n";
		else         cout << "OBEY\n";
	}
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int cases;
	cin >> cases;
	while( cases-- ) {
		int a, b, k;
		cin >> a >> b >> k;
		if( a > b ) swap(a, b);
		int gcd = __gcd(a, b);
		if( a == 1 and k >= b ) {
			cout << "OBEY\n";
			continue;
		}
		a /= gcd;
		b /= gcd;
		int have = b / a - 1;
		if( have >= k ) cout << "REBEL\n";
		else            cout << "OBEY\n";
	}
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int cases;
    cin >> cases;
    while( cases-- ) {
        ll r, b, k;
        cin >> r >> b >> k;
        if( r > b ) swap(r, b);
        ll gcd = __gcd(r, b);
        r /= gcd;
        b /= gcd;
        bool flg = false;
        auto cntMlt = [](ll a, ll b, ll x) {
            ll ret = b / x - max(0LL, a - 1) / x;
            return ret;
        };
        flg |= (cntMlt(r, b - 1, r) >= k);
        ll x = b / r + (b % r != 0);
        flg |= (cntMlt(b, r * x, b) >= k);
        cout << (flg ? "REBEL\n" : "OBEY\n");
    }
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int cases;
    cin >> cases;
    while( cases-- ) {
        ll r, b, k;
        cin >> r >> b >> k;
        if( r > b ) swap(r, b);
        ll gcd = __gcd(r, b);
        bool flg = false;
        auto cntMlt = [](ll a, ll b, ll x) {
            ll ret = b / x - max(0LL, a - 1) / x;
            return ret;
        };
        flg |= (cntMlt(r, b - 1, r) >= k);
        ll x = b / gcd + (b % gcd != 0);
        flg |= (cntMlt(b, gcd * x, b) >= k);
        cout << (flg ? "REBEL\n" : "OBEY\n");
    }
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int cases, i = 0;
    cin >> cases;
    while( cases-- ) {
        ll r, b, k;
        cin >> r >> b >> k;
        ll gcd = __gcd(r, b);
        r /= gcd;
        b /= gcd;
        if( r > b ) swap(r, b);
        bool flg = false;
        flg |= ((b + r - 2) / r >= k);
        cout << (flg ? "REBEL\n" : "OBEY\n");
    }
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int cases;
	cin >> cases;
	while( cases-- ) {
		int a, b, k;
		cin >> a >> b >> k;
		int gcd = __gcd(a, b);
		a /= gcd;
		b /= gcd;
		if( a > b ) swap(a, b);
		int have = b / a - 1;
		if( have >= k ) cout << "REBEL\n";
		else           cout << "OBEY\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(b%a==0&&(b/a)-1>=k) cout<<"REBEL"<<endl;
        else if(b%a!=0&&(b/a)>k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(((b)/a)>=k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b);
        if((b+a)/a>=k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(b%a==0&&(b/a)-1>k) cout<<"REBEL"<<endl;
        else if(b%a!=0&&(b/a)>k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
uaing namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b);
        if((b+a)/a>=k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(((b+a)/a)-1>k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {

        long long int a,b,k; cin>>a>>b>>k;

        long int g = __gcd(a, b);
	a /= g;
	b /= g;
	 if(a>b) swap(a,b); else {}
	if((k - 1) * a + 1 < b)
		cout << "REBEL";
	else
		cout << "OBEY";
	cout << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(((b)/a)>k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t; cin>>t;
    while(t--)
    {
        long int a,b,k; cin>>a>>b>>k;
        if(a>b) swap(a,b); else {}
        if(a==b) cout<<"OBEY"<<endl;
        else if(((b-1)/a)>k) cout<<"REBEL"<<endl;
        else cout<<"OBEY"<<endl;
    }
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int gcd(int a, int b)
{
    if(a % b == 0)
        return b;
    return gcd(b, a%b);
}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        int g = gcd(r,b);

        if(g + (k-1) * r < b)
            cout<<"REBEL\n";
        else
            cout<<"OBEY\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(r <= 2)
        {
            if(b/r < k)
                cout<<"OBEY\n";
            else
            {
                if(b%r == 0 && b/r <= k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }

        else
        {
            if(b%r == 1)
                if(b/r < k)
                    cout<<"OBEY\n";

            else if (b/r + 1 < k)
                cout<<"OBEY\n";

            else
            {
                if(b%r == 0 && b/r <= k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(r <= 2)
        {
            if(b/r < k)
                cout<<"OBEY\n";
            else
            {
                if(b%r == 0 && b/r <= k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }

        else
        {
            if(b%r == 0)
               if(b/r <= k)
                    cout<<"OBEY\n";
            else if(b%r == 1)
                if(b/r <k)
                    cout<<"OBEY\n";
            else
            {
                if(b/r + 1 < k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(b%r == 0)
        {
            if(b/r <= k)
                cout<<"OBEY\n";
            else
                cout<<"REBEL\n";
        }
        else if(b%r == 1)
        {
            if(b/r < k)
                cout<<"OBEY\n";
            else
                cout<<"REBEL\n";
        }
        else
        {
            if(b/r + 1 < k)
                cout<<"OBEY\n";
            else
                cout<<"REBEL\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(b%r == 0)
            if(b/r <= k)
                cout<<"OBEY\n";
        else if(b%r == 1)
            if(b/r < k)
                cout<<"OBEY\n";
        else
        {
            if(b/r + 1 < k)
                cout<<"OBEY\n";
            else
                cout<<"REBEL\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int gcd(int a, int b)
{
    if(a % b == 0)
        return b;
    return gcd(b, a%b);
}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        int g = gcd(r,b);

        if(g + (k-1) * r < b)
            cout<<"REBEL\n";
        else
            cout<<"OBEY\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(b/r < k)
            cout<<"OBEY\n";
        else
        {
            if(b%r == 0 && b/r == k)
                cout<<"OBEY\n";
            else
                cout<<"REBEL\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i = 0; i<int(n); i++)
using namespace std;
typedef long long ll;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int r,b,k;
        cin>>r>>b>>k;

        if(r > b)
            swap(r,b);

        if(r <= 2)
        {
            if(b/r < k)
                cout<<"OBEY\n";
            else
            {
                if(b%r == 0 && b/r <= k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }

        else
        {
            if(b/r + 1 < k)
                cout<<"OBEY\n";
            else
            {
                if(b%r == 0 && b/r <= k)
                    cout<<"OBEY\n";
                else
                    cout<<"REBEL\n";
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(tt>=10000&&t==1)cout<<"OBEY\n";
            else if(tt>=10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>2300)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(tt==10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>1000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000)break;
            }
            if(tt==10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>2225)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*b;
            long long le=b,ri=b*2;//cout<<le<<"   "<<ri<<endl;
            while(ri<h)
            {
                long long kk=(le/r+1)*r;
                long long ans=(ri-kk)/r+1;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                //tt++;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>5000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                if(tt>=100)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(r*1.0/(b-r)<0.001)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(tt>=10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((a+b)/(a-b)>1e5)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=201000)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>2250)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*b;
            long long le=b,ri=b*2;//cout<<le<<"   "<<ri<<endl;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                ans=(ri-kk)/r+1;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                //tt++;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*b;
            long long le=b,ri=b*2;
            while(ri<=2*r*b)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                if(tt>=10)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((a+b)/(a-b)>1000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000)break;
            }

            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=1000)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=100)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>2000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);t1=1;tt=0;}
                        else break;
                }
            }
            if(tt==10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>20000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                if(tt>=1000)break;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if((r+b)/(b-r)>2100)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}