#include<bits/stdc++.h>
using namespace std;
int lis( vector<int> &a )
{
    int n=a.size();
    int *lis, i, j, max = 0;
    lis = (int*) malloc ( sizeof( int ) * n );

    for (i = 0; i < n; i++ )
        lis[i] = 1;

    for (i = 1; i < n; i++ )
        for (j = 0; j < i; j++ )
            if ( arr[i] > arr[j] && lis[i] < lis[j] + 1)
                lis[i] = lis[j] + 1;

    /* Pick maximum of all LIS values */
    for (i = 0; i < n; i++ )
        if (max < lis[i])
            max = lis[i];

    /* Free memory to avoid memory leak */
    free(lis);

    return max;
}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<n-lcs(a)<<endl;
}


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

#include <iostream>
#include <vector>

int CeilIndex(std::vector<int> &v, int l, int r, int key) {
    while (r-l > 1) {
    int m = l + (r-l)/2;
    if (v[m] >= key)
        r = m;
    else
        l = m;
    }

    return r;
}

int LongestIncreasingSubsequenceLength(std::vector<int> &v) {
    if (v.size() == 0)
        return 0;

    std::vector<int> tail(v.size(), 0);
    int length = 1;

    tail[0] = v[0];
    for (size_t i = 1; i < v.size(); i++) {
        if (v[i] < tail[0])

            tail[0] = v[i];
        else if (v[i] > tail[length-1])

            tail[length++] = v[i];
        else

            tail[CeilIndex(tail, -1, length-1, v[i])] = v[i];
    }

    return length;
}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<n-LongestIncreasingSubsequenceLength(a)<<endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 100010;
int cars[sz], cache[sz];
int main() {
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	int n, elm;
	cin >> n;
	fill(cache, cache + n, -1);
	int res = 1;
	for (int i = 0; i < n; ++i) {
		cin >> cars[i];
		elm = cars[i] - 1;
		if (cache[elm] == -1)
			cache[cars[i]] = 1;
		else
			cache[cars[i]] = 1 + cache[elm];
		res = max(res, cache[cars[i]]);
	}
	cout << n - res;
	return 0;
}


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

  #include <ext/pb_ds/assoc_container.hpp>
  #include <ext/pb_ds/tree_policy.hpp>
  using namespace __gnu_pbds;
  #define pll pair<int,string>
  #define ordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

  #define int long long int
  #define vi vector<int>
  #define pii pair<long long ,long long>

  #define mod 1000000007
  #define hell 998244353
  #define all(x) x.begin(),x.end()
  //#define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb push_back
  #define ff first
  #define ss second
  #define rep(n) for(int i=0;i<n;i++)
  #define lb lower_bound
  #define up upper_bound

  void solve()
  {

        int n;
        cin>>n;
        vi v(n);
        rep(n)cin>>v[i];

        vi ans(n,0);
        ans[0]=v[0];
        int len=1;
        for(int i=1;i<n;i++)
        {
            auto a=ans.begin();
            auto b=ans.begin()+len;
            auto it=lower_bound(a,b,v[i]);
            if(it==ans.begin()+len)
            {
               ans[len++]=v[i];
            }
            else
            {
               *it=v[i];
            }
        }
        cout<<n-len;

  }

 signed main()
  {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int T;
    T=1;

    while(T--)
    {
      solve();
    }
    return 0;
  }


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

  #include <ext/pb_ds/assoc_container.hpp>
  #include <ext/pb_ds/tree_policy.hpp>
  using namespace __gnu_pbds;
  #define pll pair<int,string>
  #define ordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

  #define int long long int
  #define vi vector<int>
  #define pii pair<long long ,long long>

  #define mod 1000000007
  #define hell 998244353
  #define all(x) x.begin(),x.end()
  //#define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb push_back
  #define ff first
  #define ss second
  #define rep(n) for(int i=0;i<n;i++)
  #define lb lower_bound
  #define up upper_bound

  void solve()
  {

        int n;
        cin>>n;

        vi pos(n,0);
        rep(n){
          int x;
          cin>>x;
          x--;
          pos[x]=i;
        }

        int ans=0;

        int i=0;
        while(i<n)
        {
            int r=i+1;
            while(r<n && pos[r]>pos[r-1])
            {
               r++;
            }
            ans=max(ans,r-i);
            i=r;
        }
        cout<<n-ans;

  }

 signed main()
  {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int T;
    T=1;

    while(T--)
    {
      solve();
    }
    return 0;
  }


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

  #include <ext/pb_ds/assoc_container.hpp>
  #include <ext/pb_ds/tree_policy.hpp>
  using namespace __gnu_pbds;
  #define pll pair<int,string>
  #define ordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

  #define int long long int
  #define vi vector<int>
  #define pii pair<long long ,long long>

  #define mod 1000000007
  #define hell 998244353
  #define all(x) x.begin(),x.end()
  //#define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb push_back
  #define ff first
  #define ss second
  #define rep(n) for(int i=0;i<n;i++)
  #define lb lower_bound
  #define up upper_bound

  void solve()
  {

        int n;
        cin>>n;
        vi v(n);
        rep(n)cin>>v[i];
        vi dp(n+1,0);
        dp[0]=1;
        for(int i=1;i<n;i++)
        {
           if(v[i]>v[i-1])
           {
             dp[i]=dp[i-1]+1;
           }
           else
            dp[i]=dp[i-1];
        }
        cout<<n-dp[n-1];

  }

 signed main()
  {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int T;
    T=1;

    while(T--)
    {
      solve();
    }
    return 0;
  }


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n; cin >> n;
    vector <int> A(n), B(n);
    for (int &i: A) cin >> i;
    for (int i = 0; i < n; ++i) {
        B[A[i]-1] = i;
    }

    int ans = 1;
    for (int i = 0, j; i < n; ++i) {
        j = i+1;
        while (j < n and B[j] > B[j-1]) j++;
        ans = max(ans, j - i);
        i = j-1;
    }

    cout << n - ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n; cin >> n;
    vector <int> A(n), B(n);
    for (int &i: A) cin >> i;
    for (int i = 0; i < n; ++i) {
        B[A[i]-1] = i;
    }
    set <int> s;
    for (int i: B) {
        auto it = s.lower_bound(i);
        if (it == s.end()) s.insert(i);
        else {
            s.erase(it);
            s.insert(i);
        }
    }
    cout << n - sz(s);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n; cin >> n;
    vector <int> A(n);
    for (int &i: A) cin >> i;
    set <int> s;
    for (int i: A) {
        auto it = s.lower_bound(i);
        if (it == s.end()) s.insert(i);
        else {
            s.erase(it);
            s.insert(i);
        }
    }
    cout << n - sz(s);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n; cin >> n;
    vector <int> A(n), B(n);
    for (int &i: A) cin >> i;
    for (int i = 0; i < n; ++i) {
        B[A[i]-1] = i;
    }

    int ans = 0;
    for (int i = 0, j; i < n; ++i) {
        j = i+1;
        while (j < n and A[j] > A[j-1]) j++;
        ans = max(ans, j - i);
        i = j-1;
    }

    cout << n - ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n; cin >> n;
    vector <int> A(n), B(n);
    for (int &i: A) cin >> i;
    for (int i = 0; i < n; ++i) {
        B[A[i]-1] = i;
    }

    int ans = 1;
    for (int i = 0, j; i < n; ++i) {
        j = i+1;
        while (j < n and B[j] > B[j-1]) j++;
        ans = max(ans, j - i);
        i = j-1;
    }

    cout << n - ans;

    return 0;
}

/*
 * more elements would be untouched lesser will be the ans.
 * So check the longest consecutive increasing subsequence.
 * ans = n - LCIS

*/


#include <bits\stdc++.h> //Ñîðòèðîâêà âàãîíîâ
using namespace std;

int pos[100005];
int main () {
	int n, p, cnt = 1, len = 1;

	scanf ("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf ("%d", &p);
		pos[p] = i;
	}
	for (int i = 1; i < n; i++) {
		if (pos[i] < pos[i+1]) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
	}

	len = max (len, cnt);
	printf ("%d", n - len);
	return 0;
}


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

int main () {
	int n, next, prev, cnt = 1, len = 0;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev < next) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
		prev = next;
	}

	printf ("%d", n - len);
	return 0;
}


#include <bits\stdc++.h> //Ñîðòèðîâêà âàãîíîâ
using namespace std;

int main () {
	int n, next, prev, cnt = 1, len = 1;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev < next) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
		prev = next;
	}
	len = max (len, cnt);
	printf ("%d", n - len);
	return 0;
}


#include <bits\stdc++.h> //Сортировка вагонов
using namespace std;

int main () {
	int n, next, prev, cnt = 1, len = 1;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev < next) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
		prev = next;
	}

	printf ("%d", n - len);
	return 0;
}


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

int main () {
	int n, next, prev, cnt = 1, len = 0;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev < next) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
		prev = next;
	}

	printf ("%d", max (n - len, 1));
	return 0;
}


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

int main () {
	int n, next, prev, cnt = 1, len = 1;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev < next) cnt++;
		else {
			len = max (len, cnt);
			cnt = 1;
		}
		prev = next;
	}

	printf ("%d", ;
	return 0;
}


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

int main () {
	int n, next, prev, ans = 0;

	scanf ("%d%*c%d", &n, &prev);
	for (int i = 1; i < n; i++) {
		scanf ("%d", &next);
		if (prev > next) ans++;
		prev = next;
	}

	printf ("%d", ans);
	return 0;
}


/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pld pair<long double,long double>
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mod ((ll)(1e9+7))
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define inv(v) for(auto&i:v) in(i)
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define ml unordered_map<ll,ll>
#define vpl vector<pair<ll,ll>>
#define INF 0x3f3f3f3f

template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<t.first<<" "<<t.second; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }

int main() {
    ll n;in(n);
    vl v(n);
    ll pos1=-1,pos2=-1;
    for(ll i=0;i<n;i++) {
        in(v[i]);
        if(v[i]==1) pos1=i;
        if(v[i]==n) pos2=i;
    }
    ll c1=1,c2=1;
    ll req=2;
    for(ll i=pos1+1;i<n;i++) {
        if(v[i]==req) req++,c1++;
    }
    req=n-1;
    for(ll i=pos2-1;i>=0;i--) {
        if(v[i]==req) c2++,req--;
    }
    cout<<n-max(c1,c2)<<endl;
    return 0;
}


/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pld pair<long double,long double>
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mod ((ll)(1e9+7))
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define inv(v) for(auto&i:v) in(i)
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define ml unordered_map<ll,ll>
#define vpl vector<pair<ll,ll>>
#define INF 0x3f3f3f3f

template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<t.first<<" "<<t.second; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }

int main() {
    ll n;in(n);
    vl v(n);
    for(auto &i:v) in(i);
    ll l=1;
    vl lis(n);
    lis[0]=v[0];
    for(ll i=1;i<n;i++) {
        auto it = lower_bound(lis.begin(),lis.begin()+l,v[i]);
        if(it==lis.begin()+l) lis[l++]=v[i];
        else *it=v[i];
    }
    cout<<n-l<<endl;
    return 0;
}


/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pld pair<long double,long double>
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mod ((ll)(1e9+7))
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define inv(v) for(auto&i:v) in(i)
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define ml unordered_map<ll,ll>
#define vpl vector<pair<ll,ll>>
#define INF 0x3f3f3f3f

template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<t.first<<" "<<t.second; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }

int main() {
    ll n;in(n);
    vl v(n);
    for(auto &i:v) in(i);
    vl pos(n+1,1), cnt(n+1,1); ll l=1;
    for(int i=0;i<n;i++) pos[v[i]]=i;
    for(int i=2;i<=n;i++) {
        if(pos[i]>pos[i-1]) cnt[i]=cnt[i-1]+1;
        l = max(l,cnt[i]);
    }
    cout<<n-l<<endl;
    return 0;
}


/* ---------itz_me9---------- */
/* ---------ONLY GOD AND I KNOW WHAT I HAVE WRITTEN ----------*/
#include<bits/stdc++.h>
#define ll long long
#define hell 1000000007
#define vi vector<long long>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,ti,tj;
	cin>>n;
	vector<ll> a(n,1),v;
	for(i=0;i<n;i++)
	{
		ll temp;
		cin>>temp;
		v.push_back(temp);
	}
	if(n>1)
	{
		for(i=1;i<n;i++)
		{
			ti=i;
			tj=0;
			while(tj<ti)
			{
				if(v[tj]<v[ti])
					a[ti]=max(a[ti],a[tj]+1);
				tj++;
			}
		}
	}
	ll d=*(max_element(a.begin(),a.end()));
	cout<<(n-d);
	return 0;
}


/* ---------itz_me9---------- */
/* ---------ONLY GOD AND I KNOW WHAT I HAVE WRITTEN ----------*/
#include<bits/stdc++.h>
#define ll long long
#define hell 1000000007
#define vi vector<long long>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,ans;
	cin>>n;
	vector<ll> v;
	for(i=0;i<n;i++)
	{
		ll temp;
		cin>>temp;
		v.push_back(temp);
	}
	ans=n-v[n-1];
	cout<<ans;
	return 0;
}


/* ---------itz_me9---------- */
/* ---------ONLY GOD AND I KNOW WHAT I HAVE WRITTEN ----------*/
#include<bits/stdc++.h>
#define ll long long
#define hell 1000000007
#define vi vector<long long>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,ans,ind;
	cin>>n;
	vector<ll> v;
	for(i=0;i<n;i++)
	{
		ll temp;
		cin>>temp;
		v.push_back(temp);
	}
	ans=n-v[n-1];
	for(i=0;i<n;i++)
	{
		if(v[i]==1)
		{
			ind=i;
			break;
		}
	}
	for(i=0;i<ind;i++)
	{
		if(v[i]<v[n-1])
			ans++;
	}
	cout<<ans;
	return 0;
}


/* ---------itz_me9---------- */
/* ---------ONLY GOD AND I KNOW WHAT I HAVE WRITTEN ----------*/
#include<bits/stdc++.h>
#define ll long long
#define hell 1000000007
#define vi vector<long long>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n,i,maxi=-99999;
	cin>>n;
	vector<ll> v;
	map<ll,ll> m;
	for(i=0;i<n;i++)
	{
		ll temp;
		cin>>temp;
		v.push_back(temp);
	}
	for(i=0;i<n;i++)
	{
		if(m[v[i]-1]==0)
			m[v[i]]++;
		else
			m[v[i]]+=(m[v[i]-1]+1);
	}
	for(i=0;i<n;i++)
		maxi=max(maxi,m[v[i]]);
	cout<<(n-maxi);
	return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define MOD 1000000007
#define MAXN 100005
#define mem(a, v) memset(a, v, sizeof a)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define fori(i,a,b) for(int  i=(a);i<=(b);i++)
#define forl(i,a,b) for(ll  i=(a);i<=(b);i++)
#define rfor(i,a,b) for(int i=(b);i>=(a);i--)
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define all(v) (v.begin(),v.end())
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef map<string,ll> msi;
typedef set<ll> si;
int dx[] = {-1, 0, 0, 1};
int dy[] = { 0,-1, 1, 0};
                /***********code begins here***********/
int cnt[100005];
void solve(){
	int n;
	cin>>n;
	char ar[n];
	fori(i,0,n-1)
		cin>>ar[i];

	cnt[ar[n-1]]=1;
	int mx=0;
	for(int i=n-2;i>=0;i--){
		cnt[ar[i]]=cnt[ar[i]+1]+1;

		mx=max(mx,cnt[ar[i]]);
	}

	cout<<n-mx;
}
int main() {
    ios::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int T=1;
    //cin>>T;
    while(T--){
	    solve();
	    cout<<'\n';
    }
    return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define MOD 1000000007
#define MAXN 100005
#define mem(a, v) memset(a, v, sizeof a)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define fori(i,a,b) for(int  i=(a);i<=(b);i++)
#define forl(i,a,b) for(ll  i=(a);i<=(b);i++)
#define rfor(i,a,b) for(int i=(b);i>=(a);i--)
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define all(v) (v.begin(),v.end())
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef map<string,ll> msi;
typedef set<ll> si;
int dx[] = {-1, 0, 0, 1};
int dy[] = { 0,-1, 1, 0};
                /***********code begins here***********/
int cnt[100005];
void solve(){
	int n;
	cin>>n;
	char ar[n];
	fori(i,0,n-1)
		cin>>ar[i];

	if(n==1)
		{cout<<0;return;}
	cnt[ar[n-1]]=1;
	int mx=0;
	for(int i=n-2;i>=0;i--){
		cnt[ar[i]]=cnt[ar[i]+1]+1;

		mx=max(mx,cnt[ar[i]]);
	}

	cout<<n-mx;
}
int main() {
    ios::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int T=1;
    //cin>>T;
    while(T--){
	    solve();
	    cout<<'\n';
    }
    return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define MOD 1000000007
#define MAXN 100005
#define mem(a, v) memset(a, v, sizeof a)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define fori(i,a,b) for(int  i=(a);i<=(b);i++)
#define forl(i,a,b) for(ll  i=(a);i<=(b);i++)
#define rfor(i,a,b) for(int i=(b);i>=(a);i--)
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define all(v) (v.begin(),v.end())
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef map<string,ll> msi;
typedef set<ll> si;
int dx[] = {-1, 0, 0, 1};
int dy[] = { 0,-1, 1, 0};
                /***********code begins here***********/
int cnt[100005];
void solve(){
    int n;
    cin>>n;
    int ar[n];
    fori(i,0,n-1)
        cin>>ar[i];

    cnt[ar[n-1]]=1;
    int mx=1;
    for(int i=n-2;i>=0;i--){
        cnt[ar[i]]=cnt[ar[i]+1]+1;
        mx=max(mx,cnt[ar[i]]);
    }

    cout<<n-mx;
}
int main() {

    int T=1;
    //cin>>T;
    while(T--){
        solve();
        cout<<'\n';
    }
    return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
using namespace std;
int pos[100005];
void solve(){
    int n;
    cin>>n;
    int ar[n];
    fori(i,0,n-1)
        cin>>ar[i];

    pos[ar[n-1]]=1;
    int mx=1;
    for(int i=n-2;i>=0;i--){
        pos[ar[i]]=pos[ar[i]+1]+1;
        mx=max(mx,pos[ar[i]]);
    }

    cout<<n-mx;
}
int main() {

    int T=1;
    //cin>>T;
    while(T--){
        solve();
        cout<<'\n';
    }
    return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define MOD 1000000007
#define MAXN 100005
#define mem(a, v) memset(a, v, sizeof a)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define fori(i,a,b) for(int  i=(a);i<=(b);i++)
#define forl(i,a,b) for(ll  i=(a);i<=(b);i++)
#define rfor(i,a,b) for(int i=(b);i>=(a);i--)
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define all(v) (v.begin(),v.end())
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef map<string,ll> msi;
typedef set<ll> si;
int dx[] = {-1, 0, 0, 1};
int dy[] = { 0,-1, 1, 0};
                /***********code begins here***********/
int cnt[100005];
void solve(){
    int n;
    cin>>n;
    int ar[n];
    fori(i,0,n-1)
        cin>>ar[i];

    cnt[ar[n-1]]=1;
    int mx=0;
    for(int i=n-2;i>=0;i--){
        cnt[ar[i]]=cnt[ar[i]+1]+1;
        mx=max(mx,cnt[ar[i]]);
    }

    cout<<n-mx;
}
int main() {

    int T=1;
    //cin>>T;
    while(T--){
        solve();
        cout<<'\n';
    }
    return 0;
}


                    /******************gourav_j**************/
#include <bits/stdc++.h>
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define MOD 1000000007
#define MAXN 100005
#define mem(a, v) memset(a, v, sizeof a)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define fori(i,a,b) for(int  i=(a);i<=(b);i++)
#define forl(i,a,b) for(ll  i=(a);i<=(b);i++)
#define rfor(i,a,b) for(int i=(b);i>=(a);i--)
#define forit(i, a) for ( __typeof( (a).begin() ) i = (a).begin(); i != (a).end(); i++ )
#define all(v) (v.begin(),v.end())
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef map<string,ll> msi;
typedef set<ll> si;
int dx[] = {-1, 0, 0, 1};
int dy[] = { 0,-1, 1, 0};
                /***********code begins here***********/
int cnt[100005];
void solve(){
	int n;
	cin>>n;
	int ar[n];
	fori(i,0,n-1)
		cin>>ar[i];

	if(n==1)
		{cout<<0;return;}
	cnt[ar[n-1]]=1;
	int mx=0;
	for(int i=n-2;i>=0;i--){
		cnt[ar[i]]=cnt[ar[i]+1]+1;

		mx=max(mx,cnt[ar[i]]);
	}

	cout<<n-mx;
}
int main() {
    ios::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int T=1;
    //cin>>T;
    while(T--){
	    solve();
	    cout<<'\n';
    }
    return 0;
}


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

signed main()
{
  ll n;
  cin >> n;
  map<int ,int> mp;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    mp[a[i]]=i;
  }
  int p=0,q=0;
  for(int i=1;i<=n;i++)
  {
    if(mp[i]>mp[i+1])
   { p=i; break;}
  }

  for(int i=n;i>=1;i--)
  {
    if(mp[i]<mp[i-1])

    {q=n-i+1; break;}
  }
  cout<<n-max(p,q);

}


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

signed main()
{
    ll n;
    cin>> n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>> a[i];
    }
    int dp[n+1];
    memset(dp,0,sizeof(dp));

    for(int i=0;i<n;i++)
    {
       dp[a[i]]=dp[a[i]-1]+1;
    }
    int maxx=-1;
    for(int i=1;i<=n;i++)
    {
        maxx=max(maxx,dp[i]);
    }
    cout<< n-maxx;

}


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

signed main()
{
  ll n;
  cin >> n;
  map<int ,int> mp;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    mp[a[i]]=i;
  }
  if(n==1)
  cout<<"0";

  else
  { int p=0,q=0;

  for(int i=1;i<=n;i++)
  {
    if(mp[i]>mp[i+1])
   { p=i; break;}
  }

  for(int i=n;i>=1;i--)
  {
    if(mp[i]<mp[i-1])

    {q=n-i+1; break;}
  }
  cout<<n-max(p,q);

  }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define MAXNODES 100009
#define mod 1073741824

void kk ()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
}

int main()
{

    kk ();

    /*  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);*/

    int n;
    cin>>n;
    deque<int>dq,dq2;
    ll ans=0;
    for (int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        dq.push_back(x);
    }
    if (dq[n-1]!=n)
        ans+=n-dq[n-1];
    for (int i=0; i<n; i++)
    {
        if (dq[i]<dq.back())
        {
            dq2.push_back(dq[i]);
        }
    }
    //cout << ans << endl;
    dq2.push_back(dq.back());
  /*  for (int i=0; i<dq2.size(); i++)
        cout <<dq2[i] << " " ;
    cout << endl;*/
    n=dq2.size();
    while (n!=0)
    {

        if (dq2[n-1]!=n)
        {
            int temp=dq2[n-1];
            dq2.erase(dq2.begin()+n-1);
            dq2.push_front(temp);
            ans++;
        }
        else
            n--;
    }
   /* for (int i=0; i<dq2.size(); i++)
        cout <<dq2[i] << " " ;
    cout << endl;*/
    cout << ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define MAXNODES 100009
#define mod 1073741824

void kk ()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
}

int main()
{

    kk ();

    /*  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);*/

    int n;
    cin>>n;
    int arr[n];
    int pos[n];
    for (int i=0;i<n;i++)
        cin>>arr[i];
    for (int i=0;i<n;i++)
        pos[arr[i]]=i+1;
    int len=1;
    int mx=0;
    for (int i=2;i<=n;i++)
    {
        if (pos[i]>pos[i-1])
            len++;
        else
        {
            mx=max(mx,len);
            len=1;
        }
    }
    cout << n-mx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define MAXNODES 100009
#define mod 1073741824

void kk ()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
}

int main()
{

    kk ();

    /*  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);*/

    int n;
    cin>>n;
    int arr[n];
    for (int i=0;i<n;i++)
        cin>>arr[i];
    int cur=1;
    bool found=0;
    int ans=0;
    for (int i=0;i<n;i++)
    {
        if (arr[i]==cur)
            cur++,ans++;
    }
    cout << n-ans;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define MAXNODES 100009
#define mod 1073741824

void kk ()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
}

int main()
{

    kk ();

    /*  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);*/

    int n;
    cin>>n;
    int arr[n];
    int pos[n];
    for (int i=0;i<n;i++)
        cin>>arr[i];
    for (int i=0;i<n;i++)
        pos[arr[i]]=i+1;
    int len=1;
    int mx=0;
    for (int i=2;i<=n;i++)
    {
        if (pos[i]>pos[i-1])
            len++;
        else
        {
            mx=max(mx,len);
            len=1;
        }
    }
    mx=max(mx,len);
    cout << n-mx;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define MAXNODES 100009
#define mod 1073741824

void kk ()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
}

int main()
{

    kk ();

    /*  freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);*/

    int n;
    cin>>n;
    int arr[n];
    for (int i=0;i<n;i++)
        cin>>arr[i];
    int cur;
    bool found=0;
    int ans=0;
    for (int i=0;i<n;i++)
    {
        if (!found)
        {
            if (arr[i]==1)
                cur=1 ,ans++, found=true;
        }
        else
            if (arr[i]>cur)
            cur=arr[i] , ans++;
    }
    cout << n-ans;

    return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(__gcd(r, b) == 1) {
			t = (b + r - 1) / r;
		}
		else
			t = ((b + r - 1) / r) - 1;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		t = (b - 1) / r;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		if(__gcd(r, b) == 1) {
			t = (b + r - 1) / r;
		}
		else
			t = b / r;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		t = (b - 1 - __gcd(b, r)) / r;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		t = (b - __gcd(b, r)) / r;
		if(t == k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		t = (b - __gcd(b, r)) / r;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


//{
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//}
int T;
int r, b, k;
int __gcd(int a, int b) {return b == 0 ? a : __gcd(b, a % b);}
int main(){
	scanf("%d", &T);
	rep(cas, 0, T) {
		scanf("%d%d%d", &r, &b, &k);
		int t = 0;
		if(r > b) swap(b, r);
		t = (b - 1 - __gcd(b, r)) / r + 1;
		if(t >= k)
			puts("REBEL");
		else
			puts("OBEY");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int dp[100000] = {0};

long long mdc(long long a, long long b){
    return (b == 0 ? a : mdc(b, a%b));
}

void lenght(int db,int M, int m){
    // cout << "Ans " << ans << endl;
    int t1 = M, t2 = db;
    if(dp[M] and M < 100000) M = dp[M];
    else{
    while(M%m) {
        // cout << "M " << M << endl;
        M--;
    }
    M/= m;
    dp[t1] = M;
    }
    bool need = 0;
    if(!(db%m)) need = true;
    if(dp[db] and db < 100000) db = dp[db];
    else{
    while(db%m) {
        db--;
        // cout << "Db " << db << endl;
    }
    db /= m;
    dp[t2] = db;
    }
    if(need) db--;
    ans = max(ans,db-M);
}

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a; i++){
        ans = 0;
        int r,b,k;
        cin >> r >> b >> k;
        int M = max(r,b);
        int m = r + b - M;

        int db=0;
        while(db%m or !db){
            db+=M;
            // cout << "Db " << db << " M " << M << " m " << m;
            lenght(db,db-M,m);
        }
        //lenght(db,db-M,m);
        if(k <= ans) cout << "rEbEl\n";
        else cout << "oBeY\n";
    }
    return 0;
}

/*
    2 e 3:
    2 4 6 8 10 12 14 16 18
    3 6 9 12 15 18

    3 e 4:
    3 6 9 *12 15 18 21 *24 27 30 33 *36
    4 8 *12 16 20 24 28 32 *36

    2   4    8    10     14     16
      3        9             15
          6          12            18

    3   6   9     15      18     21
      4   8           16      20
               12                    24

    lenght of unable to choose: (Mm - m² + 1)
    2 e 17:
    PA de 0 ao múltiplo mais próximo de 17: n = ?
    while(M%m) M--;
    M/= m;
    lenght = n
    PA (m ... M) q =m  M = n
    2 4 6 8 10 12 14 16    18 20 22 24 26 28 30 32
                        17
                                                   34

    5 e 13:
    5 10    15 20 25   30 35    40
         13          26      39

    2 e 5:
    2 4    6 8
        5       10
*/


#include <bits/stdc++.h>
using namespace std;
int ans = 0;

long long mdc(long long a, long long b){
    return (b == 0 ? a : mdc(b, a%b));
}

void lenght(int db,int M, int m){
    // cout << "Ans " << ans << endl;
    while(M%m) {
        // cout << "M " << M << endl;
        M--;
    }
    M/= m;
    bool need = 0;
    if(!(db%m)) need = true;

    while(db%m) {
        db--;
        // cout << "Db " << db << endl;
    }
    db /= m;

    if(need) db--;
    ans = max(ans,db-M);
}

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a; i++){
        ans = 0;
        int r,b,k;
        cin >> r >> b >> k;
        int M = max(r,b);
        int m = r + b - M;

        int db=0;
        while(db*m < M*m/mdc(M,m)){
            db+=M;
            //cout << "Db " << db << " M " << M << " m " << m;
            lenght(db,db-M,m);
        }
        if(k <= ans) cout << "rEbEl\n";
        else cout << "oBeY\n";
    }
    return 0;
}

/*
    2 e 3:
    2 4 6 8 10 12 14 16 18
    3 6 9 12 15 18

    3 e 4:
    3 6 9 *12 15 18 21 *24 27 30 33 *36
    4 8 *12 16 20 24 28 32 *36

    2   4    8    10     14     16
      3        9             15
          6          12            18

    3   6   9     15      18     21
      4   8           16      20
               12                    24

    lenght of unable to choose: (Mm - m² + 1)
    2 e 17:
    PA de 0 ao múltiplo mais próximo de 17: n = ?
    while(M%m) M--;
    M/= m;
    lenght = n
    PA (m ... M) q =m  M = n
    2 4 6 8 10 12 14 16    18 20 22 24 26 28 30 32
                        17
                                                   34

    5 e 13:
    5 10    15 20 25   30 35    40
         13          26      39

    2 e 5:
    2 4    6 8
        5       10
*/


#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int dp[100000] = {0};

long long mdc(long long a, long long b){
    return (b == 0 ? a : mdc(b, a%b));
}

void lenght(int db,int M, int m){
    // cout << "Ans " << ans << endl;
    int t1 = M, t2 = db;
    if(!dp[M] and M < 100000) M = dp[M];
    else{
    while(M%m) {
        // cout << "M " << M << endl;
        M--;
    }
    M/= m;
    dp[t1] = M;
    }
    bool need = 0;
    if(!(db%m)) need = true;
    if(!dp[db] and db < 100000) db = dp[db];
    else{
    while(db%m) {
        db--;
        // cout << "Db " << db << endl;
    }
    db /= m;
    dp[t2] = db;
    }
    if(need) db--;
    ans = max(ans,db-M);
}

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a; i++){
        ans = 0;
        int r,b,k;
        cin >> r >> b >> k;
        int M = max(r,b);
        int m = r + b - M;

        int db=0;
        while(db%m){
            db+=M;
            //cout << "Db " << db << " M " << M << " m " << m;
            lenght(db,db-M,m);
        }
        lenght(db,db-M,m);
        if(k <= ans) cout << "rEbEl\n";
        else cout << "oBeY\n";
    }
    return 0;
}

/*
    2 e 3:
    2 4 6 8 10 12 14 16 18
    3 6 9 12 15 18

    3 e 4:
    3 6 9 *12 15 18 21 *24 27 30 33 *36
    4 8 *12 16 20 24 28 32 *36

    2   4    8    10     14     16
      3        9             15
          6          12            18

    3   6   9     15      18     21
      4   8           16      20
               12                    24

    lenght of unable to choose: (Mm - m² + 1)
    2 e 17:
    PA de 0 ao múltiplo mais próximo de 17: n = ?
    while(M%m) M--;
    M/= m;
    lenght = n
    PA (m ... M) q =m  M = n
    2 4 6 8 10 12 14 16    18 20 22 24 26 28 30 32
                        17
                                                   34

    5 e 13:
    5 10    15 20 25   30 35    40
         13          26      39

    2 e 5:
    2 4    6 8
        5       10
*/


#include <bits/stdc++.h>
using namespace std;
int ans = 0;

long long mdc(long long a, long long b){
    return (b == 0 ? a : mdc(b, a%b));
}

void lenght(int db,int M, int m){
    // cout << "Ans " << ans << endl;
    while(M%m) {
        // cout << "M " << M << endl;
        M--;
    }
    M/= m;
    bool need = 0;
    if(!(db%m)) need = true;

    while(db%m) {
        db--;
        // cout << "Db " << db << endl;
    }
    db /= m;

    if(need) db--;
    ans = max(ans,db-M);
}

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a; i++){
        ans = 0;
        int r,b,k;
        cin >> r >> b >> k;
        int M = max(r,b);
        int m = r + b - M;

        int db=0;
        while(db*db < M*m/mdc(M,m)){
            db+=M;
            //cout << "Db " << db << " M " << M << " m " << m;
            lenght(db,db-M,m);
        }
        if(k <= ans) cout << "rEbEl\n";
        else cout << "oBeY\n";
    }
    return 0;
}

/*
    2 e 3:
    2 4 6 8 10 12 14 16 18
    3 6 9 12 15 18

    3 e 4:
    3 6 9 *12 15 18 21 *24 27 30 33 *36
    4 8 *12 16 20 24 28 32 *36

    2   4    8    10     14     16
      3        9             15
          6          12            18

    3   6   9     15      18     21
      4   8           16      20
               12                    24

    lenght of unable to choose: (Mm - m² + 1)
    2 e 17:
    PA de 0 ao múltiplo mais próximo de 17: n = ?
    while(M%m) M--;
    M/= m;
    lenght = n
    PA (m ... M) q =m  M = n
    2 4 6 8 10 12 14 16    18 20 22 24 26 28 30 32
                        17
                                                   34

    5 e 13:
    5 10    15 20 25   30 35    40
         13          26      39

    2 e 5:
    2 4    6 8
        5       10
*/


#include <bits/stdc++.h>

#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define For(i, a) for (int i = 0; i < (a); i++)
using ll = unsigned long long;
using namespace std;

ll gcd(ll a, ll b){
    return (b==0 ? a : gcd(b,a%b) );
}

int main(){
    int t = 0;
    cin >> t;

    For(i, t){
        ll a,b,k;
        cin >> a >> b >> k;
        if(a < b) swap(a,b);
        ll n = gcd(a,b);
        cout << (string)(((a+b - n - 1)/b >= k) ? "rEbEl\n" : "oBeY\n");
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int dp[100000] = {0};

long long mdc(long long a, long long b){
    return (b == 0 ? a : mdc(b, a%b));
}

void lenght(int db,int M, int m){
    // cout << "Ans " << ans << endl;
    int t1 = M, t2 = db;
    if(M < 100000 and dp[M]) M = dp[M];
    else{
    while(M%m) {
        // cout << "M " << M << endl;
        M--;
    }
    M/= m;
    dp[t1] = M;
    }
    bool need = 0;
    if(!(db%m)) need = true;
    if(db < 100000 and dp[db]) db = dp[db];
    else{
    while(db%m) {
        db--;
        // cout << "Db " << db << endl;
    }
    db /= m;
    dp[t2] = db;
    }
    if(need) db--;
    ans = max(ans,db-M);
}

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a; i++){
        ans = 0;
        int r,b,k;
        cin >> r >> b >> k;
        int M = max(r,b);
        int m = r + b - M;

        int db=0;
        while(db%m or !db){
            db+=M;
            // cout << "Db " << db << " M " << M << " m " << m;
            lenght(db,db-M,m);
        }
        //lenght(db,db-M,m);
        if(k <= ans) cout << "rEbEl\n";
        else cout << "oBeY\n";
    }
    return 0;
}

/*
    2 e 3:
    2 4 6 8 10 12 14 16 18
    3 6 9 12 15 18

    3 e 4:
    3 6 9 *12 15 18 21 *24 27 30 33 *36
    4 8 *12 16 20 24 28 32 *36

    2   4    8    10     14     16
      3        9             15
          6          12            18

    3   6   9     15      18     21
      4   8           16      20
               12                    24

    lenght of unable to choose: (Mm - m² + 1)
    2 e 17:
    PA de 0 ao múltiplo mais próximo de 17: n = ?
    while(M%m) M--;
    M/= m;
    lenght = n
    PA (m ... M) q =m  M = n
    2 4 6 8 10 12 14 16    18 20 22 24 26 28 30 32
                        17
                                                   34

    5 e 13:
    5 10    15 20 25   30 35    40
         13          26      39

    2 e 5:
    2 4    6 8
        5       10
*/


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  r*k<b+max(r-__gcd(r,b),__gcd(r,b))  ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
ll a[maxn];

int main()
{
	ll t;
	cin>>t;
	while( t-- )
	{
		ll r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  r*k<b+( r==1 ? 0 : max(r-__gcd(r,b),__gcd(r,b) ) )  ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
ll a[maxn];

int main()
{
	ll t;
	cin>>t;
	while( t-- )
	{
		ll r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  r*k<b+r-__gcd(r,b)  ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  ( r*k<(2*b-b/r*r) ) ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if( r*k<b || ( r*k<(2*b-r) ) ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
ll a[maxn];

int main()
{
	ll t;
	cin>>t;
	while( t-- )
	{
		ll r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  r*k <= r + b - __gcd(r,b)-1   ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if(  r*k<b+r-__gcd(r,b)  ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if( r*k<b ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if( r*k<b || ( r*k<(b+r-__gcd(r,b) ) ) ) puts("REBEL");
		else puts("OBEY");
	}
}


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

const int maxn=2e5+10;
int a[maxn];

int main()
{
	int t;
	cin>>t;
	while( t-- )
	{
		int r,b,k;
		cin>>r>>b>>k;
		if( r>b ) swap(r,b);
		if( r*k<b || ( r*k<(2*b-b/r*r) ) ) puts("REBEL");
		else puts("OBEY");
	}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	int c = (r-1)/b;
    	r *= 2;
    	int cc = (r-1)/b - c;
    	if(cc > c) cout<<"REBEL\n";
    	else if(c < k) cout<<"OBEY\n";
    	else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	int c = (r-1)/b;
    	if(c != k) cout<<"OBEY\n";
    	else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	int c = max(1,(r-1)/b);
    	r *= 2;
    	int cc = (r-1)/b - c;
    	//cout<<cc<<endl;
    	if(cc >= k || c >= k) cout<<"REBEL\n";
    	else cout<<"OBEY\n";
    	//else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;

    	int g = __gcd(r,b);
    	r /= g;
    	b /= g;

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

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


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	int c = (r-1)/b;
    	if(c < k) cout<<"OBEY\n";
    	else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	ll c = (r-1)/b;
    	if(c == 0) c = 1;
    	ll d = r/b;
    	ll bb = b * (d+1);
    	r += r;
    	ll cc = (r-bb)/b;
    	//cout<<cc<<" "<<d<<endl;
    	//cout<<cc<<endl;
    	if(cc >= k || c >= k) cout<<"REBEL\n";
    	else cout<<"OBEY\n";
    	//else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	ll c = (r-1)/b;
    	if(c == 0) c = 1;
    	ll d = r/b;
    	ll bb = b * (d+1);
    	ll dif = bb - r;
    	ll cc = (r + r -bb-1)/b + (dif != 0);
    	//cout<<cc<<" "<<d<<endl;
    	//cout<<cc<<endl;
    	if(cc >= k || c >= k) cout<<"REBEL\n";
    	else cout<<"OBEY\n";
    	//else cout<<"REBEL\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 1e9 + 7;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t,r,b,k;
    cin>>t;
    while(t--) {
    	cin>>r>>b>>k;
    	if(b > r) swap(r,b);
    	int c = max(1,(r-1)/b);
    	r *= 2;
    	int cc = (r-1)/b - c;
    	//cout<<cc<<endl;
    	if(cc > c) cout<<"REBEL\n";
    	else if(c < k) cout<<"OBEY\n";
    	else cout<<"REBEL\n";
    }
    return 0;
}


# include <iostream>
# include <algorithm>
using namespace std;

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

int main()
{
	int T;
	cin >>T;

	while(T--)
	{
		int g, t;
		int r, b, k;
		cin >>r >>b >>k;
		g = gcd(r, b);
		if(r > b) swap(r, b);

		t = (b+r-1-g)/r;
		if(t >= k) cout<<"REBEL"<<endl;
		else cout<<"OBEY"<<endl;
	}

}


# include <iostream>
# include <algorithm>
using namespace std;

typedef long long ll;

int main()
{
	int T;
	cin >>T;
	while(T--)
	{
		int flag = 0;
		long long r, b, k, t, s;
		cin >>r >>b >>k;

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

		long long nr, nb;
		nr = b-1;
		nb = r;

		if(nr % nb == 0)
			t = nr / nb;
		else
			t = nr / nb + 1;

		if(k == 1) cout<<"REBEL" <<endl;
		else if(t >= k) cout<<"REBEL" <<endl;
		else cout<<"OBEY" << endl;
	}
}


# include <iostream>
# include <algorithm>
using namespace std;

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

int main()
{
	int T;
	cin >>T;

	while(T--)
	{
		int g, t;
		int r, b, k;
		cin >>r >>b >>k;
		g = gcd(r, b);
		if(r > b) swap(r, b);

		t = (b+r-2-g)/r;
		if(t >= k) cout<<"REBEL"<<endl;
		else cout<<"OBEY"<<endl;
	}

}


# include <iostream>
# include <algorithm>
using namespace std;

int main()
{
	int T;
	cin >>T;
	while(T--)
	{
		long long r, b, k, t;
		cin >>r >>b >>k;
		if(r > b) swap(r, b);

		t = b/r;
		if(b%r == 0) t--;
		if(t == k) cout<<"REBEL" <<endl;
		else cout<<"OBEY" << endl;
	}
}


# include <iostream>
# include <algorithm>
using namespace std;

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

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

		t = b/r;
		if(b%r == 0) t--;
		if(k == 1) cout<<"REBEL" <<endl;
		else if(t >= k) cout<<"REBEL" <<endl;
		else cout<<"OBEY" << endl;
	}
}


# include <iostream>
# include <algorithm>
using namespace std;

int main()
{
	int T;
	cin >>T;
	while(T--)
	{
		long long r, b, k, t;
		cin >>r >>b >>k;
		if(r > b) swap(r, b);

		t = b/r;
		if(b%r == 0) t--;
		if(t >= k) cout<<"REBEL" <<endl;
		else cout<<"OBEY" << endl;
	}
}


# include <iostream>
# include <algorithm>
using namespace std;

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

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

		t = b/r;
		if(b%r == 0) t--;
		if(t <= 1 && k == 1) cout<<"REBEL" <<endl;
		else if(t >= k) cout<<"REBEL" <<endl;
		else cout<<"OBEY" << endl;
	}
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
//	freopen("color.in","r",stdin);
//	freopen("color.out","w",stdout);
	int t = read();
	int p1, p2, k, gcd;
	while(t --)
	{
		p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((p2 - 2) / p1 + 1 < k) printf("OBEY\n");
		else printf("REBEL\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
	int t = read();
	while(t --)
	{
		int p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		int gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((k - 1) * p1 + 1 >= p2) printf("OBEY\n");
		else printf("REBEL\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
//#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
	int t = read();
	while(t --)
	{
		int p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		int gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((k - 1) * p1 + 1 >= p2) printf("OBEY\n");
		else printf("REBEL\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
inline void swap(int &a, int &b)
{
	int c = a;
	a = b;
	b = c;
	return ;
}
signed main()
{
	int t = read();
	int p1, p2, k, gcd;
	while(t --)
	{
		p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((k - 1) * p1 + 1 >= p2) printf("OBEY\n");
		else printf("REBEL\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
	// freopen("color.in","r",stdin);
	// freopen("color.out","w",stdout);
	int t = read();
	int p1, p2, k, gcd;
	while(t --)
	{
		p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((p2 - 2) / p1 + 1 < k) printf("OBEY\n");
		else printf("REBEL\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
//	freopen("color.in","r",stdin);
//	freopen("color.out","w",stdout);
	int t = read();
	int p1, p2, k, gcd;
	while(t --)
	{
		p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((p2 - 2) / p1 + 1 < k) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}


#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
#define int long
using namespace std;
const int N = 1000010, INF = 1e9;
inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - 48; cc = getchar();}
	return cn * flus;
}
inline int mygcd(int a, int b)
{
    while(b ^= a ^= b ^= a %= b);
    return a;
}
signed main()
{
	int t = read();
	while(t --)
	{
		int p1, p2, k;
		p1 = read();
		p2 = read();
		k = read();
		int gcd = mygcd(p1, p2);
		p1 /= gcd;
		p2 /= gcd;
		if(p1 > p2) swap(p1, p2);
		if((k - 1) * p1 + 1 >= p2) puts("OBEY");
		else puts("REBEL");
	}
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&r,&b,&k);
		int gcd=__gcd(r,b);
		int ma=max(r,b)/gcd;
		int mi=min(r,b)/gcd;
		if((k-1)*mi+1<ma){
			puts("rebel");
		}
		else{
			puts("obey");
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&r,&b,&k);
		int ma=max(r,b);
		int mi=min(r,b);
		if(ma/mi<k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
    //cjjzz
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&r,&b,&k);
		int gcd=__gcd(r,b);
		int ma=max(r,b)/gcd;
		int mi=min(r,b)/gcd;
		if((k-1)*mi+1<ma){
			puts("rebel");
		}
		else{
			puts("obey");
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&r,&b,&k);
		int ma=max(r,b);
		int mi=min(r,b);
		int len=ma-mi;
		if(len/mi<k){
			puts("obey");
		}
		else{
			puts("rebel");
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d%d",&r,&b,&k);
		int gcd=__gcd(r,b);
		int ma=max(r,b)/gcd;
		int mi=min(r,b)/gcd;
		if(ma/mi<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
int t,r,b,k;

int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d%d",&r,&b,&k);
		int ma=max(r,b);
		int mi=min(r,b);
		if(ma/mi<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,r,b,k;

signed main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&r,&b,&k);
		int gcd=__gcd(r,b);
		int ma=max(r,b);
		int mi=min(r,b);
		if(((ma*mi/gcd)/mi)/((ma*mi/gcd)/ma)<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}
}


#include <cstdio>
#define int long long
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int gcd(int a,int b){
	return !b?a:gcd(b,a%b);
}

signed main(){
	int t=R(),r,p,k,l;
	while(t--){
		r=R();
		p=R();
		if(r<p)
			r^=p^=r^=p;
		l=gcd(r,p);
		r/=l;
		p/=l;
		k=R();
		if((r-1)/p+1<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>
#define int long long
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

signed main(){
	int t=R(),r,p,k;
	while(t--){
		r=R();
		p=R();
		k=R();
		if(r<p)
			r^=p^=r^=p;
		if(r/p+1<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>
#define int long long
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int gcd(int a,int b){
	return !b?a:gcd(b,a%b);
}

signed main(){
	int t=R(),r,p,k,l;
	while(t--){
		r=R();
		p=R();
		if(r<p)
			r^=p^=r^=p;
		l=gcd(r,p);
		r/=l;
		p/=l;
		k=R();
		if(p*(k-1)+1>=r){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>
#define int long long
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int gcd(int a,int b){
	return !b?a:gcd(b,a%b);
}

signed main(){
	int t=R(),r,p,k,l;
	while(t--){
		r=R();
		p=R();
		if(r<p)
			r^=p^=r^=p;
		l=gcd(r,p);
		r/=l;
		p/=l;
		k=R();
		if(p*(k-1)+1<r){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>

int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int main(){
	int t=R(),r,p,k;
	while(t--){
		r=R();
		p=R();
		k=R();
		if(r<p)
			r^=p^=r^=p;
		if((r-1)/p+1<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>
#define int long long
int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

signed main(){
	int t=R(),r,p,k;
	while(t--){
		r=R();
		p=R();
		k=R();
		if(r<p)
			r^=p^=r^=p;
		if((r-1)/p+1<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>

int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int main(){
	int t=R(),r,p,k;
	while(t--){
		r=R();
		p=R();
		k=R();
		if(r<p)
			r^=p^=r^=p;
		if(r/p<k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include <cstdio>

int R(){
	int x=0;char ch;
	do{ch=getchar();}while(ch>57||ch<48);
	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);
	return x;
}

int main(){
	int t=R(),r,p,k;
	while(t--){
		r=R();
		p=R();
		k=R();
		if(r<p)
			r^=p^=r^=p;
		if(r/p<=k){
			puts("OBEY");
		}
		else{
			puts("REBEL");
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
	if (a==0) return b;
	return gcd(b%a,a);
}
long long lcm(long long a, long long b)
 {
    return (a*b)/gcd(a, b);
 }
 int main(){
 	int t;
 	cin>>t;
 	while(t--){
 		long long r,b,k;
 		cin>>r>>b>>k;
 		if(min(r,b)*k<max(r,b)){
 			cout<<"REBEL"<<endl;
		 }
		 else{
		 	cout<<"OBEY"<<endl;
		 }
	 }
	 return 0;
 }


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


#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
	if (a==0) return b;
	return gcd(b%a,a);
}
long long lcm(long long a, long long b)
 {
    return (a*b)/gcd(a, b);
 }
 int main(){
 	int t;
 	cin>>t;
 	while(t--){
 		long long r,b,k;
 		cin>>r>>b>>k;
 		long long num=lcm(r,b);
 		long long numr=0,numb=0;
 		int ok=1;
 		for(int i=1;i<num;i++){
 			if(i%r==0){ numr++;numb=0;
			 }
			if(i%b==0){
				numb++;
				numr=0;
			}
			if(numr>=k||numb>=k){
				ok=0;
				break;
			}
		 }
		 if(ok) cout<<"OBEY"<<endl;
		 else cout<<"REBEL"<<endl;
	 }
	 return 0;
 }


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


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


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


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


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


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


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

// int gcdExtended(int a, int b, int *x, int *y);

// // Function to find modulo inverse of a
// void modInverse(int a, int m)
// {
//     int x, y;
//     int g = gcdExtended(a, m, &x, &y);
//     if (g != 1)
//         return INF;
//     else
//     {
//         // m is added to handle negative x
//         int res = (x%m + m) % m;
//         return res;
//     }
// }

// // C function for extended Euclidean Algorithm
// int gcdExtended(int a, int b, int *x, int *y)
// {
//     // Base Case
//     if (a == 0)
//     {
//         *x = 0, *y = 1;
//         return b;
//     }

//     int x1, y1; // To store results of recursive call
//     int gcd = gcdExtended(b%a, a, &x1, &y1);

//     // Update x and y using results of recursive
//     // call
//     *x = y1 - (b/a) * x1;
//     *y = x1;

//     return gcd;
// }

void solve(){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a > b) swap(a,b);
	ll mx = 0;
	int g = __gcd(a,b);
	int cnt = 0;
	int curr = g;
	cnt = (b-g)/a;

	if(cnt < k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

// int gcdExtended(int a, int b, int *x, int *y);

// // Function to find modulo inverse of a
// void modInverse(int a, int m)
// {
//     int x, y;
//     int g = gcdExtended(a, m, &x, &y);
//     if (g != 1)
//         return INF;
//     else
//     {
//         // m is added to handle negative x
//         int res = (x%m + m) % m;
//         return res;
//     }
// }

// // C function for extended Euclidean Algorithm
// int gcdExtended(int a, int b, int *x, int *y)
// {
//     // Base Case
//     if (a == 0)
//     {
//         *x = 0, *y = 1;
//         return b;
//     }

//     int x1, y1; // To store results of recursive call
//     int gcd = gcdExtended(b%a, a, &x1, &y1);

//     // Update x and y using results of recursive
//     // call
//     *x = y1 - (b/a) * x1;
//     *y = x1;

//     return gcd;
// }

void solve(){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a > b) swap(a,b);
	ll mx = 0;
	ll g = __gcd(a,b);
	ll cnt = 0;
	ll curr = g;
	cnt = (b-g)/a;
	if(cnt < k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

void solve(){
	int r,b,k;
	cin >> r >> b >> k;
	if(r > b) swap(r,b);
	int cnt = b/r;
	//cout << cnt << endl;
	if(cnt <= k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

void solve(){
	int r,b,k;
	cin >> r >> b >> k;
	if(r > b) swap(r,b);
	int cnt = 0;
	for(int i = b;i >= 0; i-=r) cnt++;
	cnt--;
	if(cnt <= k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

// int gcdExtended(int a, int b, int *x, int *y);

// // Function to find modulo inverse of a
// void modInverse(int a, int m)
// {
//     int x, y;
//     int g = gcdExtended(a, m, &x, &y);
//     if (g != 1)
//         return INF;
//     else
//     {
//         // m is added to handle negative x
//         int res = (x%m + m) % m;
//         return res;
//     }
// }

// // C function for extended Euclidean Algorithm
// int gcdExtended(int a, int b, int *x, int *y)
// {
//     // Base Case
//     if (a == 0)
//     {
//         *x = 0, *y = 1;
//         return b;
//     }

//     int x1, y1; // To store results of recursive call
//     int gcd = gcdExtended(b%a, a, &x1, &y1);

//     // Update x and y using results of recursive
//     // call
//     *x = y1 - (b/a) * x1;
//     *y = x1;

//     return gcd;
// }

void solve(){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a > b) swap(a,b);
	ll mx = 0;
	for(ll i = 1;i <= 1e6;i++){
		mx = max(mx,(b*i)%a);
	}
	//cout << mx << endl;
	ll cnt = (b-mx)/a;
	//cout << cnt << endl;
	//if(mx == 0) cnt--;
	if(cnt <= k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

// int gcdExtended(int a, int b, int *x, int *y);

// // Function to find modulo inverse of a
// void modInverse(int a, int m)
// {
//     int x, y;
//     int g = gcdExtended(a, m, &x, &y);
//     if (g != 1)
//         return INF;
//     else
//     {
//         // m is added to handle negative x
//         int res = (x%m + m) % m;
//         return res;
//     }
// }

// // C function for extended Euclidean Algorithm
// int gcdExtended(int a, int b, int *x, int *y)
// {
//     // Base Case
//     if (a == 0)
//     {
//         *x = 0, *y = 1;
//         return b;
//     }

//     int x1, y1; // To store results of recursive call
//     int gcd = gcdExtended(b%a, a, &x1, &y1);

//     // Update x and y using results of recursive
//     // call
//     *x = y1 - (b/a) * x1;
//     *y = x1;

//     return gcd;
// }

void solve(){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a > b) swap(a,b);
	ll mx = 0;
	for(ll i = 1;i <= 1e3;i++){
		mx = max(mx,(b*i)%a);
	}
	//cout << mx << endl;
	ll cnt = (b-mx)/a;
	//cout << cnt << endl;
	//if(mx == 0) cnt--;
	if(cnt <= k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>     /* srand, rand */
#include <time.h>       /* time */
#define mt make_tuple
#define ll long long
#define eb emplace_back
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define scanVec(vec , n) for(int i = 0; i < n ; i++){ scanf("%d",&vec[i]);}
#define printVec(vec , n) for(int i = 0; i < n ; i++){ cout<<vec[i]<<" ";}
#define mod(a,b) ((a%b +b)%b)
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define max(a,b) (a<b?b:a)
#define min(a,b) (a>b?b:a)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define lastEle(vec) vec[vec.size()-1]
#define SZ(x) ((int)((x).size()))
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626

using namespace std;
 using namespace __gnu_pbds;
 template <typename T>
 using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//----------------------------------------------------------------------------------------------------------------------

void swap(int & a, int & b){
    auto temp = a;
    a = b;
    b = temp;
}

const ll MOD = 1e9 + 7;

ll inf = 1LL*1e11;

void no(){
    cout <<"REBEL" << endl;
}

void yes(){
    cout <<"OBEY" << endl;
}

// int gcdExtended(int a, int b, int *x, int *y);

// // Function to find modulo inverse of a
// void modInverse(int a, int m)
// {
//     int x, y;
//     int g = gcdExtended(a, m, &x, &y);
//     if (g != 1)
//         return INF;
//     else
//     {
//         // m is added to handle negative x
//         int res = (x%m + m) % m;
//         return res;
//     }
// }

// // C function for extended Euclidean Algorithm
// int gcdExtended(int a, int b, int *x, int *y)
// {
//     // Base Case
//     if (a == 0)
//     {
//         *x = 0, *y = 1;
//         return b;
//     }

//     int x1, y1; // To store results of recursive call
//     int gcd = gcdExtended(b%a, a, &x1, &y1);

//     // Update x and y using results of recursive
//     // call
//     *x = y1 - (b/a) * x1;
//     *y = x1;

//     return gcd;
// }

void solve(){
	ll a,b,k;
	cin >> a >> b >> k;
	if(a > b) swap(a,b);
	ll mx = 0;
	int g = __gcd(a,b);
	int cnt = 0;
	int curr = g;
	for(int i = g;i < b;i+=a) cnt++;
//	cout << cnt << endl;
	if(cnt < k) yes();
	else no();
}

int main(){
	int t;
	cin >> t;
	while(t--) solve();
    return 0;
}