import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Long> ti=new ArrayDeque<>(b);
        ArrayDeque<Long> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        ArrayList ar=new ArrayList();int k=0;
        int count=0;
        for(int i=0;i<n;i++) {
            long t = in.nextInt();
            long d = in.nextInt();
            k++;

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {

                    long t0 = ti.pollFirst();
                    long d0 = di.pollFirst();
                    if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else ar.add(k);

        }
        while(ti.size()>0) {
            while (ar.contains(count + 1)) {
                ar.remove((Object) (count + 1));
                System.out.print(-1 + " ");
                count++;
            }
            long t0 = ti.pollFirst();
            long d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }
        int y=ar.size();
        for(int i=0;i<y;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Long> ti=new ArrayDeque<>(b);
        ArrayDeque<Long> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        ArrayList ar=new ArrayList();int k=0;
        int count=0;
        for(int i=0;i<n;i++) {
            long t = in.nextInt();
            long d = in.nextInt();
            k++;

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                    long t0 = ti.pollFirst();
                    long d0 = di.pollFirst();
                    if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else ar.add(k);

        }
        while(ti.size()>0) {
            while (ar.contains(count + 1)) {
                ar.remove((Object) (count + 1));
                System.out.print(-1 + " ");
                count++;
            }
            long t0 = ti.pollFirst();
            long d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }
        int y=ar.size();
        for(int i=0;i<y;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Long> ti=new ArrayDeque<>(b);
        ArrayDeque<Long> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        //ArrayList ar=new ArrayList();
         int k=0;
        int ar[]=new int[n+1];
        int count=0;int net=0;
        for(int i=0;i<n;i++) {
            long t = in.nextInt();
            long d = in.nextInt();
            k++;

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {

                    long t0 = ti.pollFirst();
                    long d0 = di.pollFirst();
                    if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    while (ar[count+1]!=0) {
                       // ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;net--;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else {
                    ar[k]=1;net++;
                }

        }
        while(ti.size()>0) {
            while (ar[count+1]!=0) {
                // ar.remove((Object) (count+1));
                System.out.print(-1 + " ");
                count++;net--;
            }
            long t0 = ti.pollFirst();
            long d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }

        for(int i=0;i<net;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Integer> ti=new ArrayDeque<>(b);
        ArrayDeque<Integer> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        ArrayList ar=new ArrayList();int k=0;
        int count=0;
        for(int i=0;i<n;i++) {
            int t = in.nextInt();
            int d = in.nextInt();
            k++;

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                    int t0 = ti.pollFirst();
                    int d0 = di.pollFirst();
                    if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else ar.add(k);

        }
        while(ti.size()>0) {
            while (ar.contains(count + 1)) {
                ar.remove((Object) (count + 1));
                System.out.print(-1 + " ");
                count++;
            }
            int t0 = ti.pollFirst();
            int d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0 && ti.peekFirst()<t0+d0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }
        int y=ar.size();
        for(int i=0;i<y;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Integer> ti=new ArrayDeque<>(b);
        ArrayDeque<Integer> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        ArrayList ar=new ArrayList();int k=0;
        int count=0;
        for(int i=0;i<n;i++) {
            int t = in.nextInt();
            int d = in.nextInt();
            k++;

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {
                    int t0 = ti.pollFirst();
                    int d0 = di.pollFirst();
                    if (ti.size() > 0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    while (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else ar.add(k);

        }
        while(ti.size()>0) {
            while (ar.contains(count + 1)) {
                ar.remove((Object) (count + 1));
                System.out.print(-1 + " ");
                count++;
            }
            int t0 = ti.pollFirst();
            int d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }
        int y=ar.size();
        for(int i=0;i<y;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Андрей on 16.03.2016.
 */
public class KR {
  //  public static PrintWriter pw;
    public static void main(String[] args) throws FileNotFoundException {
        // Scanner    in = new Scanner(new File("input.txt"));
        //  pw = new PrintWriter(new File("output.txt"));
        Scanner in = new Scanner(System.in);
      //  pw = new PrintWriter(System.out);
        int n=in.nextInt();
        int b=in.nextInt();
        ArrayDeque<Integer> ti=new ArrayDeque<>(b);
        ArrayDeque<Integer> di=new ArrayDeque<>(b);
     //   pw.println(ti.peek());
      //  pw.println(ti.size());
        ArrayList ar=new ArrayList();int k=0;
        int count=0;
        for(int i=0;i<n;i++) {
            int t = in.nextInt();
            int d = in.nextInt();
            k++;
            if (ti.size() == 0) {
                ti.addLast(t);
                di.addLast(d);
            } else {

                while (ti.size() != 0 && ti.peekFirst() + di.peekFirst() <= t) {
                    int t0 = ti.pollFirst();
                    int d0 = di.pollFirst();
                    if (ti.size() > 0) {
                        ti.pollFirst();
                        ti.addFirst(t0 + d0);
                    }
                    System.out.print((t0 + d0) + " ");
                    count++;
                    if (ar.contains(count+1)) {
                        ar.remove((Object) (count+1));
                        System.out.print(-1 + " ");
                        count++;
                    }
                }

                if (ti.size() <= b) {
                    ti.addLast(t);
                    di.addLast(d);
                } else ar.add(k);

            }
        }
        while(ti.size()>0) {
            if (ar.contains(count + 1)) {
                ar.remove((Object) (count + 1));
                System.out.print(-1 + " ");
                count++;
            }
            int t0 = ti.pollFirst();
            int d0 = di.pollFirst();
            System.out.print((t0 + d0) + " ");
            count++;

            if (ti.size() > 0) {
                ti.pollFirst();
                ti.addFirst(t0 + d0);
            }

        }
        int y=ar.size();
        for(int i=0;i<y;i++){
            System.out.print(-1+" ");
        }
       // pw.close();
    }
}


import java.util.*;
import java.io.*;

public class F {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public void solve() {
		int n = in.nextInt();
		int b = in.nextInt();
		int[][] a = new int[n][2];
		for (int i = 0; i < a.length; i++) {
			a[i][0] = in.nextInt();
			a[i][1] = in.nextInt();
		}
		LinkedList<Integer> list = new LinkedList<>();
		long time = 0;
		int i = 0;
		long[] ans = new long[n];
		while (i < n) {
			if (list.size() != 0) {
				time += a[list.getFirst()][1];
				ans[list.getFirst()] = time;
				list.removeFirst();
				while (i < n && a[i][0] < time) {
					if (list.size() == b) {
						ans[i] = -1;
						i++;
					} else {
						list.add(i);
						i++;
					}
				}
			} else {
				list.add(i);
				time = a[i][0];
				i++;
			}
		}
		while(list.size() > 0) {
			time += a[list.getFirst()][1];
			ans[list.getFirst()] = time;
			list.removeFirst();
		}
		for (int j = 0; j < ans.length; j++) {
			out.print(ans[j] + " ");
		}
	}

	public void run() {
		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("segments.in"));
				out = new PrintWriter(new File("segments.out"));
			}
			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] arg) {
		new F().run();
	}
}


import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int[][] a = new int[n][m];
		int k = in.nextInt();
		for (int i = 0; i < k; i++) {
			if (in.nextInt() == 1) {
				int r = in.nextInt();
				int c = in.nextInt();
				for (int j = 0; j < m; j++) {
					a[r - 1][j] = c;
				}
			} else {
				int r = in.nextInt();
				int c = in.nextInt();
				for (int j = 0; j < n; j++) {
					a[j][r - 1] = c;
				}
			}
		}
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				System.out.print(a[i][j] + " ");
			}
			System.out.println();
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by yujiahao on 3/16/16.
 */

public class croc_b {
    private FastScanner in;
    private PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();
        int b = in.nextInt();
        long[][] query = new long[n][2];
        for (int i=0; i<n; i++){
            query[i][0] = in.nextLong();
            query[i][1] = in.nextLong();
        }

        LinkedList<Integer> queue = new LinkedList<Integer>();

        long[] res = new long[n];

        LinkedList<Integer> candidates = new LinkedList<Integer>();
        for (int i=0; i<n; i++)
            candidates.offer(i);

        long curTime = 0;
        int cur = 0;
        long finishTime = 0;

        while (!candidates.isEmpty() || !queue.isEmpty()){
            if (!queue.isEmpty()){
                cur = queue.poll();
            }else{
                cur = candidates.poll();
                curTime = query[cur][0];
            }

            finishTime = curTime + query[cur][1];
            res[cur] = finishTime;
            curTime = finishTime;

            while (!candidates.isEmpty() && query[candidates.peek()][0]<finishTime){
                if (queue.size()<b){
                    queue.offer(candidates.poll());
                }else{
                    res[candidates.poll()] = -1;
                }
            }
        }

        for (int i=0; i<n; i++){
            out.print(res[i]+" ");
        }

    }

    public void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public BigInteger nextBigInteger() { return new BigInteger(next());}

    }

    public static void main(String[] arg) {
        new croc_b().run();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by yujiahao on 3/16/16.
 */

public class croc_b {
    private FastScanner in;
    private PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();
        int b = in.nextInt();
        int[][] query = new int[n][2];
        for (int i=0; i<n; i++){
            query[i][0] = in.nextInt();
            query[i][1] = in.nextInt();
        }

        LinkedList<Integer> queue = new LinkedList<Integer>();

        int[] res = new int[n];

        LinkedList<Integer> candidates = new LinkedList<Integer>();
        for (int i=0; i<n; i++)
            candidates.offer(i);

        int curTime = 0;
        int cur = 0;
        int finishTime = 0;

        while (!candidates.isEmpty() || !queue.isEmpty()){
            if (!queue.isEmpty()){
                cur = queue.poll();
            }else{
                cur = candidates.poll();
                curTime = query[cur][0];
            }

            finishTime = curTime + query[cur][1];
            res[cur] = finishTime;
            curTime = finishTime;

            while (!candidates.isEmpty() && query[candidates.peek()][0]<finishTime){
                if (queue.size()<b){
                    queue.offer(candidates.poll());
                }else{
                    res[candidates.poll()] = -1;
                }
            }
        }

        for (int i=0; i<n; i++){
            out.print(res[i]+" ");
        }

    }

    public void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public BigInteger nextBigInteger() { return new BigInteger(next());}

    }

    public static void main(String[] arg) {
        new croc_b().run();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by yujiahao on 3/16/16.
 */

public class croc_b {
    private FastScanner in;
    private PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();
        int b = in.nextInt();
        int[][] query = new int[n][2];
        for (int i=0; i<n; i++){
            query[i][0] = in.nextInt();
            query[i][1] = in.nextInt();
        }

        LinkedList<Integer> queue = new LinkedList<Integer>();
        queue.offer(0);

        int curTime = query[0][0];
        int[] res = new int[n];
        int nextItem = 1;
        int curItem = 0;

        while (!queue.isEmpty() || nextItem<n){
            if (!queue.isEmpty()) {
                curItem = queue.poll();
            }else{
                curItem = nextItem;
            }

            int finishTime = Math.max(curTime, query[curItem][0]) + query[curItem][1];
            res[curItem] = finishTime;
            curTime = finishTime;
            while (nextItem<n && nextItem<n && query[nextItem][0]<finishTime){
                if (queue.size()<b){
                    queue.offer(nextItem++);
                }else{
                    res[nextItem++] = -1;
                }
            }
        }

        for (int i=0; i<n; i++){
            out.print(res[i]+" ");
        }

    }

    public void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public BigInteger nextBigInteger() { return new BigInteger(next());}

    }

    public static void main(String[] arg) {
        new croc_b().run();
    }
}


import java.util.*;

public class R644B {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n, b, t, d;
		n=in.nextInt();
		b=in.nextInt();
		long[] ans = new long[n];
		Queue q = new LinkedList();
		long it=0;
		for(int i=0; i<n; i++)
		{
			t=in.nextInt();
			d=in.nextInt();
			int[] td = {i, t, d};
			if (it==0) it=t;
			if (q.size()>0 && it<((int[])q.element())[1]) it=((int[])q.element())[1];
			while (q.size()>0 && it+((int[])q.element())[2]<=t)
			{
				if (it<((int[])q.element())[1]) it=((int[])q.element())[1];
				it+=((int[])q.element())[2];
				ans[((int[])q.element())[0]]=it;
				q.remove();
			}

			if (q.size()<b+1)
				q.add(td);
			else
				ans[i]=-1;
		}
		while (q.size()>0)
		{
			if (it<((int[])q.element())[1]) it=((int[])q.element())[1];
			it+=((int[])q.element())[2];
			ans[((int[])q.element())[0]]=it;
			q.remove();
		}
		for (int i=0; i<n; i++)
			System.out.print(ans[i]+" ");
	}
}


import java.util.*;

public class R644B {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n, b, t, d;
		n=in.nextInt();
		b=in.nextInt();
		long[] ans = new long[n];
		Queue q = new LinkedList();
		long it=0;
		for(int i=0; i<n; i++)
		{
			t=in.nextInt();
			d=in.nextInt();
			int[] td = {i, t, d};
			if (it==0) it=t;
			while (q.size()>0 && it+((int[])q.element())[2]<=t)
			{
				if (it<((int[])q.element())[1]) it=((int[])q.element())[1];
				it+=((int[])q.element())[2];
				ans[((int[])q.element())[0]]=it;
				q.remove();
			}

			if (q.size()<b+1)
				q.add(td);
			else
				ans[i]=-1;
		}
		while (q.size()>0)
		{
			if (it<((int[])q.element())[1]) it=((int[])q.element())[1];
			it+=((int[])q.element())[2];
			ans[((int[])q.element())[0]]=it;
			q.remove();
		}
		for (int i=0; i<n; i++)
			System.out.print(ans[i]+" ");
	}
}


import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.util.stream.*;
public class Main {
  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int b = sc.nextInt();
    long[] t = new long[n];
    long[] d = new long[n];

    for(int i = 0; i < n; i++) {
      t[i] = sc.nextLong();
      d[i] = sc.nextLong();
    }

    LinkedList<Long> queue = new LinkedList<>();

    long done1 = 0;
    long temp = 0;
    for(int i = 0; i < n; i++) {
      if (queue.isEmpty()) {
        queue.add(t[i] + d[i]);
        System.out.print(t[i] + d[i] + " ");
        done1 = t[i] + d[i];
        temp = t[i] + d[i];
        continue;
      }

      if (queue.size() <= b) {
        queue.add(Math.max(temp, t[i]) + d[i]);
        System.out.print(Math.max(temp, t[i]) + d[i] + " ");
        temp = Math.max(temp, t[i]) + d[i];
      } else {
        if (done1 > t[i]) System.out.print(-1 + " ");
        else {
        queue.remove();
        queue.add(Math.max(temp, t[i]) + d[i]);
        System.out.print(Math.max(temp, t[i]) + d[i] + " ");
        temp = Math.max(temp, t[i]) + d[i];
        done1 = (long) queue.peek();
        }
      }

    }

  }

}


import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.util.stream.*;
public class Main {
  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int b = sc.nextInt();
    Long[] t = new Long[n];
    Long[] d = new Long[n];

    for(int i = 0; i < n; i++) {
      t[i] = sc.nextLong();
      d[i] = sc.nextLong();
    }

    LinkedList<Long> queue = new LinkedList<>();
    /*
    5 1

    done1 = 0

    -> 2 9 : t = 2, d = 9;

    -> queue.size() < b :

    -> done1 < t : -> done1 = t + d = 2 + 9 = 11;

    -> print : "11";

    queue : [11]

    -> 4 8 : t = 4, d = 8;

    -> queue.size() < b;
    -> done1 > t : -> done1 += d = 11 + 8 = 19;

    ->print : "19";

    queue : [11,19];

    -> 10 9 : t = 10, d = 9;

    -> queue.size() > b: -> print : "-1";

    -> 15 2 : t = 15, d = 2;

    -> print number that <= t in queue -> queue :[19];

    -> queue.size() < b :

    -> done1 = 19 > t -> done1 += d =  19 + 2 = 21

    -> print : "21"

    -> queue :[19,21];

    -> 19 1 : t = 19, d = 1;

    -> print number that <= t in queue -> queue :[21];

    -> queue.size() < b :

    -> done1 = 21 > t -> done1 += d =  21 + 1 = 22

    -> print : "22"

    -> queue :[21,22];
    */

    int done1 = 0;
    List<Long> tasks = new ArrayList<>();
    int rejected = 0;
    Long temp = new Long(0);
    for(int i = 0; i < d.length; i++) {
      if (queue.isEmpty()) {
        queue.add(t[i] + d[i]);
        done1 = i;
        continue;
      }

      while (t[i] >= queue.peek() || queue.peek() == -1) {
        tasks.add(queue.remove());
        done1++;
      }

      if (i - done1 - 1 - rejected >= b) {
        queue.add((long)-1);
        rejected++;
      } else {
        if (temp == 0) {
          temp = queue.peek() + d[i];
          queue.add(queue.peek() + d[i]);
        } else {
          queue.add(temp + d[i]);
          temp = temp + d[i];
        }
      }

    }

    while(!queue.isEmpty())
      tasks.add(queue.remove());

    for(int i = 0; i < tasks.size(); i++)
        System.out.println(tasks.get(i));

  }

}


import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.util.stream.*;
public class Main {
  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int b = sc.nextInt();
    int[] t = new int[n];
    int[] d = new int[n];

    for(int i = 0; i < n; i++) {
      t[i] = sc.nextInt();
      d[i] = sc.nextInt();
    }

    LinkedList<Integer> queue = new LinkedList<>();
    /*
    5 1

    done1 = 0

    -> 2 9 : t = 2, d = 9;

    -> queue.size() < b :

    -> done1 < t : -> done1 = t + d = 2 + 9 = 11;

    -> print : "11";

    queue : [11]

    -> 4 8 : t = 4, d = 8;

    -> queue.size() < b;
    -> done1 > t : -> done1 += d = 11 + 8 = 19;

    ->print : "19";

    queue : [11,19];

    -> 10 9 : t = 10, d = 9;

    -> queue.size() > b: -> print : "-1";

    -> 15 2 : t = 15, d = 2;

    -> print number that <= t in queue -> queue :[19];

    -> queue.size() < b :

    -> done1 = 19 > t -> done1 += d =  19 + 2 = 21

    -> print : "21"

    -> queue :[19,21];

    -> 19 1 : t = 19, d = 1;

    -> print number that <= t in queue -> queue :[21];

    -> queue.size() < b :

    -> done1 = 21 > t -> done1 += d =  21 + 1 = 22

    -> print : "22"

    -> queue :[21,22];
    */

    int done1 = 0;
    List<Integer> tasks = new ArrayList<>();
    int rejected = 0;
    int temp = 0;
    for(int i = 0; i < d.length; i++) {
      if (queue.isEmpty()) {
        queue.add(t[i] + d[i]);
        done1 = i;
        continue;
      }

      while (t[i] >= queue.peek() || queue.peek() == -1) {
        tasks.add(queue.remove());
        done1++;
      }

      if (i - done1 - 1 - rejected >= b) {
        queue.add(-1);
        rejected++;
      } else {
        if (temp == 0) {
          temp = queue.peek() + d[i];
          queue.add(queue.peek() + d[i]);
        } else {
          queue.add(temp + d[i]);
          temp = temp + d[i];
        }
      }

    }

    while(!queue.isEmpty())
      tasks.add(queue.remove());

    for(int i = 0; i < tasks.size(); i++)
        System.out.println(tasks.get(i));

  }

}


import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.util.stream.*;
public class Main {
  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int b = sc.nextInt();
    long[] t = new long[n];
    long[] d = new long[n];

    for(int i = 0; i < n; i++) {
      t[i] = sc.nextLong();
      d[i] = sc.nextLong();
    }

    LinkedList<Long> queue = new LinkedList<>();

    long processingTime = 0;
    List<Long> tasks = new ArrayList<>();
    for(int i = 0; i < n; i++) {
      if (queue.size() > b && queue.peek() > t[i]) tasks.add(-1L);
      else {
        if (queue.size() > b) {
          queue.remove();
        }
        processingTime = Math.max(processingTime, t[i]) + d[i];
        queue.add(processingTime);
        tasks.add(processingTime);
      }

    }

    System.out.println(tasks.stream().
                       map(String::valueOf).
                       collect(Collectors.joining(" ")));

  }

}


import java.io.*;
import java.util.Scanner;
import java.util.*;
import java.util.stream.*;
 public class Main {
  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int b = sc.nextInt();
    long[] t = new long[n];
    long[] d = new long[n];

    for(int i = 0; i < n; i++) {
      t[i] = sc.nextLong();
      d[i] = sc.nextLong();
    }

    LinkedList<Long> queue = new LinkedList<>();

    long done1 = 0;
    long temp = 0;
    for(int i = 0; i < n; i++) {
      if (queue.isEmpty()) {
        queue.add(t[i] + d[i]);
        System.out.print(t[i] + d[i] + " ");
        done1 = t[i] + d[i];
        temp = t[i] + d[i];
        continue;
      }

      if (queue.size() <= b) {
        queue.add(temp + d[i]);
        System.out.print(temp + d[i] + " ");
        temp = temp + d[i];
      } else {
        if (done1 > t[i]) System.out.print(-1 + " ");
        else {
        queue.remove();
        queue.add(temp + d[i]);
        System.out.print(temp + d[i] + " ");
        temp = temp + d[i];
        done1 = (long) queue.peek();
        }
      }

    }

  }

}


import java.io.*;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;

public class Main {

    static class ArrayComp implements Comparator<Long[]> {
        @Override
        public int compare(Long[] st1, Long[] st2) {
            if (st1[0] < st2[0]) return -1;
            if (st1[0] == st2[0] && st1[1] < st2[1]) return -1;
            return 1;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedInputStream in = new BufferedInputStream(new DataInputStream(System.in));
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int[] tasks = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        Queue<Integer> taskList = new LinkedBlockingQueue<>();
        Queue<Long[]> events = new PriorityQueue<>(tasks[0], new ArrayComp());

        long[] taskDur = new long[tasks[0]];
        for (int i = 0; i < tasks[0]; i++) {
            long[] taskInput = Arrays.stream(reader.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
            taskDur[i] = taskInput[1];
            events.add(new Long[] {taskInput[0], (long)(i+1)});
        }
        long[] sol = new long[tasks[0]];
        while (events.size() > 0) {
            Long[] event = events.poll();
            long time = event[0];
            int task = event[1].intValue();
            if (task == 0) { // top task finished
                int taskId = taskList.poll()-1;
                sol[taskId] = time;
                if (!taskList.isEmpty()) {
                    // Next from queue starts execution, notification about its finish time
                    events.add(new Long[]{time + taskDur[taskList.peek() - 1], 0L});
                }
            } else { // add task to queue if possible
                if (taskList.size() <= tasks[1]) {
                    taskList.add(task);
                    if (taskList.size() == 1) {
                        // at this time I will finish
                        events.add(new Long[]{time + taskDur[task-1], 0L});
                    }
                } else {
                    sol[task-1] = -1;
                }
            }
        }
        System.out.println(Arrays.stream(sol).boxed().map(Object::toString)
                .collect(Collectors.joining(" ")));
    }
}


import java.io.*;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedInputStream in = new BufferedInputStream(new DataInputStream(System.in));
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int[] tasks = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        Queue<Integer> taskList = new LinkedBlockingQueue<>();
        Queue<Long> events = new PriorityQueue<>(tasks[0]);

        long[] taskDur = new long[tasks[0]];
        for (int i = 0; i < tasks[0]; i++) {
            long[] taskInput = Arrays.stream(reader.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
            taskDur[i] = taskInput[1];
            events.add(taskInput[0] * 2 + 1);
        }
        long[] sol = new long[tasks[0]];
        int nextTask = 0;
        while (events.size() > 0) {
            long event = events.poll();
            long time = event / 2;
            if (event%2 == 0) { // top task finished
                int taskId = taskList.poll();
                sol[taskId] = time;
                if (!taskList.isEmpty()) {
                    // Next from queue starts execution, notification about its finish time
                    events.add((time + taskDur[taskList.peek()]) * 2);
                }
            } else { // add task to queue if possible
                int task = nextTask++;
                if (taskList.size() <= tasks[1]) {
                    taskList.add(task);
                    if (taskList.size() == 1) {
                        // at this time I will finish
                        events.add((time + taskDur[task]) * 2);
                    }
                } else {
                    sol[task] = -1;
                }
            }
        }
        System.out.println(Arrays.stream(sol).boxed().map(Object::toString)
                .collect(Collectors.joining(" ")));
    }
}


import java.io.*;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;

public class Main {

    static class ArrayComp implements Comparator<Long[]> {
        @Override
        public int compare(Long[] st1, Long[] st2) {
            if (st1[0] < st2[0]) return -1;
            if (st1[0] == st2[0] && st1[1] < st2[1]) return -1;
            if (st1[0] == st2[0] && st1[1] == st2[1]) return 0;
            return 1;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedInputStream in = new BufferedInputStream(new DataInputStream(System.in));
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int[] tasks = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        Queue<Integer> taskList = new LinkedBlockingQueue<>();
        Queue<Long[]> events = new PriorityQueue<>(tasks[0], new ArrayComp());

        long[] taskDur = new long[tasks[0]];
        for (int i = 0; i < tasks[0]; i++) {
            long[] taskInput = Arrays.stream(reader.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
            taskDur[i] = taskInput[1];
            events.add(new Long[] {taskInput[0], (long)i});
        }
        long[] sol = new long[tasks[0]];
        while (events.size() > 0) {
            Long[] event = events.poll();
            long time = event[0];
            int task = event[1].intValue();
            if (task == -1L) { // top task finished
                int taskId = taskList.poll();
                sol[taskId] = time;
                if (!taskList.isEmpty()) {
                    // Next from queue starts execution, notification about its finish time
                    events.add(new Long[]{time + taskDur[taskList.peek()], -1L});
                }
            } else { // add task to queue if possible
                if (taskList.size() <= tasks[1]) {
                    taskList.add(task);
                    if (taskList.size() == 1) {
                        // at this time I will finish
                        events.add(new Long[]{time + taskDur[task], -1L});
                    }
                } else {
                    sol[task] = -1;
                }
            }
        }
        System.out.println(Arrays.stream(sol).boxed().map(Object::toString)
                .collect(Collectors.joining(" ")));
    }
}


import java.io.*;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedInputStream in = new BufferedInputStream(new DataInputStream(System.in));
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int[] tasks = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        Queue<Integer> taskList = new LinkedBlockingQueue<>();
        Queue<Long> events = new PriorityQueue<>();

        long[] taskDur = new long[tasks[0]];
        for (int i = 0; i < tasks[0]; i++) {
            long[] taskInput = Arrays.stream(reader.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
            taskDur[i] = taskInput[1];
            events.add((taskInput[0]<<20) + i+1);
        }
        long[] sol = new long[tasks[0]];
        while (events.size() > 0) {
            long event = events.poll();
            long time = (event >> 20);
            int task = (int)(event % (1 << 20));
            if (task == 0) { // top task finished
                int taskId = taskList.poll()-1;
                sol[taskId] = time;
                if (!taskList.isEmpty()) {
                    // Next from queue starts execution, notification about its finish time
                    events.add((time + taskDur[taskList.peek() - 1]) << 20);
                }
            } else { // add task to queue if possible
                if (taskList.size() <= tasks[1]) {
                    taskList.add(task);
                    if (taskList.size() == 1) {
                        // at this time I will finish
                        events.add((time + taskDur[task-1]) << 20);
                    }
                } else {
                    sol[task-1] = -1;
                }
            }
        }
        System.out.println(Arrays.stream(sol).boxed().map(Object::toString)
                .collect(Collectors.joining(" ")));
    }
}


public class MyCode {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int b = sc.nextInt();

    Queue<Integer> finishTime = new LinkedList<Integer>();

    int lastFinished = 0;
    for (int i = 0; i < n; i++) {
      int arr = sc.nextInt();
      int pro = sc.nextInt();
      lastFinished = lastFinished < arr ? arr : lastFinished;

      while (!finishTime.isEmpty() && finishTime.peek() <= arr){
        finishTime.remove();
      }

      if (finishTime.size() <= b){
        lastFinished += pro;
        finishTime.add(lastFinished);
        System.out.print(lastFinished + " ");
      }
      else {
        System.out.print("-1 ");
      }
    }
  }
}


import java.io.*;
import java.util.*;

public class MyCode {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int b = sc.nextInt();

    Queue<Integer> finishTime = new LinkedList<Integer>();

    int lastFinished = 0;
    for (int i = 0; i < n; i++) {
      int arr = sc.nextInt();
      int pro = sc.nextInt();
      lastFinished = lastFinished < arr ? arr : lastFinished;

      while (!finishTime.isEmpty() && finishTime.peek() <= arr){
        finishTime.remove();
      }

      if (finishTime.size() <= b){
        lastFinished += pro;
        finishTime.add(lastFinished);
        System.out.print(lastFinished + " ");
      }
      else {
        System.out.print("-1 ");
      }
    }
  }
}


import java.io.*;
import java.util.*;

public class MyCode {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int b = sc.nextInt();

    Queue<Long> finishTime = new LinkedList<Long>();

    long lastFinished = 0;
    for (int i = 0; i < n; i++) {
      long arr = sc.nextInt();
      long pro = sc.nextInt();
      lastFinished = lastFinished < arr ? arr : lastFinished;

      while (!finishTime.isEmpty() && finishTime.peek() <= arr){
        finishTime.remove();
      }

      if (finishTime.size() <= b){
        lastFinished += pro;
        finishTime.add(lastFinished);
        System.out.print(lastFinished + " ");
      }
      else {
        System.out.print("-1 ");
      }
    }
  }
}


import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Queries {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int b = sc.nextInt();
        List<Task> tasks = new ArrayList<>();
        int [] res = new int[n];

        for (int i = 0; i < n; ++i) {
            tasks.add(new Task(sc.nextInt(), sc.nextInt()));
        }
        boolean free = true;
        int nextFree = 0;
        PriorityQueue<Task> pq = new PriorityQueue<>(tasks);
        Queue<Task> q = new LinkedList<>();
        int time = 0;
        Task current = null;
        int counter = 0;
        for (int i = 0; i < Integer.MAX_VALUE;) {
            if (current != null && current.finishTime <= i) {
                free = true;
            }
            Task next = pq.peek();
            if (next != null && next.startTime == i) {
                if (q.size() < b || (free && q.size() - 1 < b)) {
                    q.add(next);
                } else {
                    counter++;
                    next.finishTime = -1;
                }
                pq.poll();
            }
            if (free && !q.isEmpty()) {
                if (q.peek().startTime <= i) {
                    current = q.poll();
                    free = false;
                    current.finishTime = i + current.procTime;
                    counter++;
                }
            }
            if (counter == n) {
                break;
            }
            if (current != null && !pq.isEmpty())
                i = Math.min(current.finishTime, pq.peek().startTime);
            else if (!pq.isEmpty())
                i = pq.peek().startTime;
            else  if (current != null)
                i = current.finishTime;

        }

        for (Task t : tasks) {
            System.out.print(t.finishTime + " ");
        }
        System.out.println();
    }

    static class Task implements Comparable<Task> {
        int startTime;
        int procTime;
        int finishTime;
        public Task(int startTime, int procTime) {
            this.startTime = startTime;
            this.procTime = procTime;
        }

        @Override
        public int compareTo(Task o) {
            return Integer.compare(startTime, o.startTime);
        }
    }
}


import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Queries {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int b = sc.nextInt();
        List<Task> tasks = new LinkedList<>();
        List<Task> copy = new LinkedList<>();
        int [] res = new int[n];
        for (int i = 0; i < n; ++i) {
            Task e = new Task(sc.nextLong(), sc.nextLong());
            tasks.add(e);
            copy.add(e);
        }
        boolean free = true;
        Queue<Task> pq = (Queue<Task>) tasks;
        Queue<Task> q = new LinkedList<>();
        Task current = null;
        int counter = 0;
        for (long i = 0; i < Long.MAX_VALUE;) {
            if (current != null && current.finishTime <= i) {
                current = null;
                free = true;
            }
            Task next = pq.peek();
            if (next != null && next.startTime == i) {
                if (q.size() < b || (free && q.size() - 1 < b)) {
                    q.add(next);
                } else {
                    counter++;
                    next.finishTime = -1;
                }
                pq.poll();
            }
            if (free && !q.isEmpty()) {
                if (q.peek().startTime <= i) {
                    current = q.poll();
                    free = false;
                    current.finishTime = i + current.procTime;
                    counter++;
                }
            }
            if (counter == n) {
                break;
            }
            if (current != null && !pq.isEmpty())
                i = Math.min(current.finishTime, pq.peek().startTime);
            else if (!pq.isEmpty())
                i = pq.peek().startTime;
            else  if (current != null)
                i = current.finishTime;
            else if (!q.isEmpty())
                i = q.peek().startTime;

        }

        for (Task t : copy) {
            System.out.print(t.finishTime + " ");
        }
        System.out.println();
    }

    static class Task implements Comparable<Task> {
        long startTime;
        long procTime;
        long finishTime;
        public Task(long startTime, long procTime) {
            this.startTime = startTime;
            this.procTime = procTime;
        }

        @Override
        public int compareTo(Task o) {
            return Long.compare(startTime, o.startTime);
        }
    }
}


def gcd(a,b):
    if(b==0):
        return a
    return gcd(b,a%b)
t=int(input())
for _ in range(t):
    r,b,k=map(int,input().split())
    mini=min(r,b)
    maxi=max(r,b)
    gg=gcd(mini,maxi)
    mini=mini//gg
    maxi=maxi//gg
    if((k-1)*mini+1<maxi):
        print("REBEL")
    else:
        print("OBEY")


t=int(input())
for _ in range(t):
    r,b,k=map(int,input().split())
    mini=min(r,b)
    maxi=max(r,b)
    if(mini*k<maxi):
        print("REBEL")
    else:
        print("OBEY")


from math import gcd

t = int(input())

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


#!python3
"""
w1ld [dog] inbox dot ru

1 100 98
1 100 99

1 2
"""

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt, gcd
import unittest

def read_int():
    return int(input().strip())

def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

for test in range(read_int()):
    r, b, k = read_int_array()
    r, b = (r, b) if r < b else (b, r)
    if gcd(b, r) == 1:
        print('OBEY' if r == b or (b-2)//r+1 < k else 'REBEL')
    else:
        print('OBEY' if r == b or b//r < k else 'REBEL')


#!python3
"""
w1ld [dog] inbox dot ru

1 100 98
1 100 99

6 16
2
3 8

0 6 12    18 24 30    36 42 48
0      16          32       48
"""

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt, gcd
import unittest

def read_int():
    return int(input().strip())

def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

for test in range(read_int()):
    r, b, k = read_int_array()
    r, b = (r, b) if r < b else (b, r)
    d = gcd(b, r)
    if d != 1:
        r //= d
        b //= d
    print('OBEY' if r == b or (b-2)//r+1 < k else 'REBEL')


#!python3
"""
w1ld [dog] inbox dot ru

1 100 98
1 100 99

"""

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
    return int(input().strip())

def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

for test in range(read_int()):
    r, b, k = read_int_array()
    r, b = (r, b) if r < b else (b, r)
    print('OBEY' if r == b or (b-2)//r+1 < k else 'REBEL')


#!python3
"""
w1ld [dog] inbox dot ru
"""

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
    return int(input().strip())

def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

for test in range(read_int()):
    r, b, k = read_int_array()
    r, b = (r, b) if r < b else (b, r)
    print('OBEY' if r == b or (b-2)//2+1 < k else 'REBEL')


#!python3
"""
w1ld [dog] inbox dot ru

1 100 98
1 100 99

1 2
"""

from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt, gcd
import unittest

def read_int():
    return int(input().strip())

def read_int_array():
    return [int(i) for i in input().strip().split(' ')]

######################################################

for test in range(read_int()):
    r, b, k = read_int_array()
    r, b = (r, b) if r < b else (b, r)
    if gcd(b, r) == 1:
        print('OBEY' if r == b or (b-2)//r+1 < k else 'REBEL')
    else:
        print('OBEY' if r == b or b//r - 1 < k else 'REBEL')


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
n.times do
  a,b,k = inp
  gcd = (a).gcd(b)
  max = [a,b].max
  min = [a,b].min
  if(([(max-gcd-1)/min,0].max + 1)>=k)
    puts "REBEL"
    next
  else
    puts "OBEY"
  end
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
n.times do
  a,b,k = inp
  if(r_up(a,b)>k or r_up(b,a)>k)
    puts "REBEL"
  else
    puts "OBEY"
  end
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
n.times do
  a,b,k = inp
  gcd = (a).gcd(b)
  a = a - gcd + 1
  b = b - gcd + 1
  if(r_up(a,b)>k or r_up(b,a)>k)
    puts "REBEL"
    next
  else
    puts "OBEY"
  end
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
n.times do
  a,b,k = inp
  gcd = (a).gcd(b)
  max = [a,b].max
  min = [a,b].min
  if((max-gcd)/min>=k)
    puts "REBEL"
    next
  else
    puts "OBEY"
  end
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
n.times do
  a,b,k = inp
  gcd = (a).gcd(b)
  max = [a,b].max
  min = [a,b].min
  if((max-gcd)/min>=(k) or k == 1)
    puts "REBEL"
    next
  else
    puts "OBEY"
  end
end


def infiniteFence():
    n = input()
    for _ in range(n):
        r, b, k = map(int, raw_input().split())
        m, n = max(r, b), min(r, b)
        print "OBEY" if m/n < k or (m%n == 0 and m/n == k) else "REBEL"

infiniteFence()


def infiniteFence():
    import fractions
    n = input()
    for _ in range(n):
        r, b, k = map(int, raw_input().split())
        m, n = max(r, b), min(r, b)
        print "REBEL" if fractions.gcd(m, n) + (k-1) * n < m else "OBEY"

infiniteFence()


def infiniteFence():
    n = input()
    for _ in range(n):
        r, b, k = map(int, raw_input().split())
        print "OBEY" if max(r, b)/min(r,b) <= k else "REBEL"

infiniteFence()


def infiniteFence():
    n = input()
    for _ in range(n):
        r, b, k = map(int, raw_input().split())
        print "OBEY" if max(r, b)/min(r,b) < k else "REBEL"

infiniteFence()


from sys import stdin, stdout

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

def main():
	n = int(stdin.readline())
	while n> 0:
		n-=1
		a, b, k = [int(x) for x in stdin.readline().split()]
		g = gcd(a,b)
		a /= g
		b /= g
		if a > b:
			a, b = b, a
		if (k - 1) * a + 1 < b:
			stdout.write("REBEL\n")
		else:
			stdout.write("OBEY\n")

if __name__ == "__main__":
	main()


# -*- coding: utf-8 -*-

import sys

tests_count = int(sys.stdin.readline().strip())

OBEY = 'OBEY\n'
REBEL = 'REBEL\n'
for _ in xrange(tests_count):
    a, b, k = map(int, sys.stdin.readline().strip().split())
    if a > b:
        a, b = b, a

    # b > a

    if a * k < b:
        sys.stdout.write(REBEL)
        continue

    # - - - 7 - - - 11 (осталось набрать 3 (7 - 11 % 7)) - - - 4
    # 7, 11, 2 -> b(0), r(7), b(11), r(14), r(21), b(22)
    # 2, 3, 2

    if b % a != 0:
        rest = a - (b % a)

        d, m = divmod((2 * b - (b + rest)), a)
        # m != 0 => we are not at the choose color point
        if d == k - 1 and m:
            sys.stdout.write(REBEL)
            continue

    sys.stdout.write(OBEY)


# -*- coding: utf-8 -*-

import sys

tests_count = int(sys.stdin.readline().strip())

OBEY = 'OBEY\n'
REBEL = 'REBEL\n'
for _ in xrange(tests_count):
    a, b, k = map(int, sys.stdin.readline().strip().split())
    if a > b:
        a, b = b, a

    # b > a

    if a * k < b:
        sys.stdout.write(REBEL)
        continue

    # 7, 11, 2 -> b(0), r(7), b(11), r(14), r(21), b(22)
    #                                -------------
    # 5, 7, 2 -> b(0), r(5), b(7), r(10), b(14), r(15), r(20), b(21)
    #                                            ------------

    remainder = b % a
    if remainder:
        if (a / remainder) * remainder < a:
            max_remainder = (a / remainder) * remainder  # bad naming
        else:
            max_remainder = (a / remainder) * (remainder - 1)

        d, m = divmod(max_remainder + b, a)
        if d == k and m:
            sys.stdout.write(REBEL)
            continue

    sys.stdout.write(OBEY)


# -*- coding: utf-8 -*-

import sys

tests_count = int(sys.stdin.readline().strip())

OBEY = 'OBEY\n'
REBEL = 'REBEL\n'
for _ in xrange(tests_count):
    a, b, k = map(int, sys.stdin.readline().strip().split())
    if a > b:
        a, b = b, a

    # b > a

    if a * k < b:
        sys.stdout.write(REBEL)
        continue

    # 7, 11, 2 -> b(0), r(7), b(11), r(14), r(21), b(22)
    #                                -------------
    # 5, 7, 2 -> b(0), r(5), b(7), r(10), b(14), r(15), r(20), b(21)
    #                                            ------------

    if a * k == b:
        sys.stdout.write(OBEY)
        continue

    # b > a, a * k > b
    r = b % a
    if r:
        cumulative_r = ((a - 1) / r) * r
        d, m = divmod(cumulative_r + b, a)
        if d == k and m:
            sys.stdout.write(REBEL)
            continue

    sys.stdout.write(OBEY)


# -*- coding: utf-8 -*-

import sys

tests_count = int(sys.stdin.readline().strip())

OBEY = 'OBEY\n'
REBEL = 'REBEL\n'
for _ in xrange(tests_count):
    a, b, k = map(int, sys.stdin.readline().strip().split())
    if a > b:
        a, b = b, a

    # b > a

    if a * k < b:
        sys.stdout.write(REBEL)
        continue

    sys.stdout.write(OBEY)


# -*- coding: utf-8 -*-

import sys

tests_count = int(sys.stdin.readline().strip())

OBEY = 'OBEY\n'
REBEL = 'REBEL\n'
for _ in xrange(tests_count):
    a, b, k = map(int, sys.stdin.readline().strip().split())
    if a > b:
        a, b = b, a

    # b > a

    if a * k < b:
        sys.stdout.write(REBEL)
        continue

    # - - - 7 - - - 11 (осталось набрать 3 (7 - 11 % 7)) - - - 4
    # 7, 11, 2 -> b(0), r(7), b(11), r(14), r(21), b(22)
    # 2, 3, 2

    if b % a != 0:
        rest = a - (b - a)

        d, m = divmod((2 * b - (b + rest)), a)
        # m != 0 => we are not at the choose color point
        if (2 * b - (b + rest)) / a == k - 1 and m:
            sys.stdout.write(REBEL)
            continue

    sys.stdout.write(OBEY)


import fractions
from math import ceil
t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    r, b =r/fractions.gcd(r, b), b/fractions.gcd(r, b)
    mx, mn = max(r, b), min(r, b)
    if ceil((mx-1)/mn) >= k:
        print("REBEL")
    else:
        print("OBEY")


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


t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b), min(r, b)
    if mx/mn >= k - 1:
        print 'REBEL'
    else:
        print 'OBEY'


import fractions
t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    r, b =r/fractions.gcd(r, b), b/fractions.gcd(r, b)
    mx, mn = max(r, b), min(r, b)
    if ceil((mx-1)/mn) >= k:
        print("REBEL")
    else:
        print("OBEY")


t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b), min(r, b)
    if mx/mn >= k:
        print 'REBEL'
    else:
        print 'OBEY'


import fractions
t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b)/fractions.gcd(r, b), min(r, b)/fractions.gcd(r, b)
    if k ==1:
        print 'OBEY'
    elif mx%mn == 0 and mx/mn > k:
        print 'REBEL'
    elif mx%mn != 0 and mx/mn >= k:
         print 'REBEL'
    else:
        print 'OBEY'


t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b), min(r, b)
    if mx%mn == 0 and mx/mn > k:
        print 'REBEL'
    elif mx%mn != 0 and mx/mn >= k:
         print 'REBEL'
    else:
        print 'OBEY'


import fractions
from math import ceil
t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    r, b =r//fractions.gcd(r, b), b//fractions.gcd(r, b)
    mx, mn = max(r, b), min(r, b)
    if ceil((mx-1)/mn) >= k:
        print("REBEL")
    else:
        print("OBEY")


t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b), min(r, b)
    if mx/mn > k:
        print 'REBEL'
    else:
        print 'OBEY'


t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b), min(r, b)
    if k ==1:
        print 'OBEY'
    elif mx%mn == 0 and mx/mn > k:
        print 'REBEL'
    elif mx%mn != 0 and mx/mn >= k:
         print 'REBEL'
    else:
        print 'OBEY'


from math import ceil, gcd
t = int(raw_input())
for i in range(t):
    r, b, k = map(int, raw_input().split())
    mx, mn = max(r, b)/gcd(r, b), min(r, b)/gcd(r, b)
    if k ==1:
        print 'OBEY'
    elif mx%mn == 0 and mx/mn > k:
        print 'REBEL'
    elif mx%mn != 0 and mx/mn >= k:
         print 'REBEL'
    else:
        print 'OBEY'


#include<stdio.h>
//long long int gcd(long long int a,long long int b)
//{
	long long int gcd(long long int x,long long int y){
    if(x%y==0)
        return y;
    else
        return gcd(y,x%y);
}
//        if(a==0)
  //              return b;
    //    else
      //          return (b%a,a);
//}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		else if(a>b)
		{
			c=(a-s-1)/b+1;
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
		}
		else{
			  c=(b-s-1)/a+1;
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		if(a>b)
		{
			c=(a-s)/b+1;
			st=2*a/s;
			if(st*s==2*a)
			{
				if(c-1>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
			else{
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
		}
		if(b>a)
		{
			  c=(b-s)/a+1;
                        st=2*b/s;
                        if(st*s==2*b)
                        {
                                if(c-1>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
                        else{
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		if(a>b)
		{
			c=(a-s)/b+1;
			st=2*a/b;
			if(st*b==2*a)
			{
				if(c-1>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
			else{
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
		}
		if(b>a)
		{
			  c=(b-s)/a+1;
                        st=2*b/a;
                        if(st*a==2*b)
                        {
                                if(c-1>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
                        else{
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		if(a>b)
		{
			c=(a-s-1)/b+1;
			//st=2*a/b;
		//	if(st*b==2*a)
		//	{
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
		//	}
		//	else{
		//		if(c>=k)
		//			printf("REBEL\n");
		//		else
		//			printf("OBEY\n");
		//	}
		}
		if(b>a)
		{
			  c=(b-s-1)/a+1;
                      //  st=2*b/a;
                       // if(st*a==2*b)
                       // {
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                      //  }
                       // else{
                         //       if(c>=k)
                           //             printf("REBEL\n");
                             //   else
                               //         printf("OBEY\n");
                       // }
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		if(a>b)
		{
			c=(a-s-1)/b+1;
			//st=2*a/b;
		//	if(st*b==2*a)
		//	{
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
		//	}
		//	else{
		//		if(c>=k)
		//			printf("REBEL\n");
		//		else
		//			printf("OBEY\n");
		//	}
		}
		if(b>a)
		{
			  c=(b-s-1)/a+1;
                      //  st=2*b/a;
                       // if(st*a==2*b)
                       // {
                                if(c-1>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                      //  }
                       // else{
                         //       if(c>=k)
                           //             printf("REBEL\n");
                             //   else
                               //         printf("OBEY\n");
                       // }
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		else if(a>b)
		{
			c=(a-s-1)/b+1;
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
		}
		else{
			  c=(b-s-1)/a+1;
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
long long int gcd(long long int a,long long int b)
{
        if(a==0)
                return b;
        else
                return (b%a,a);
}

int main(){
	long long int t,a,b,k,c,st,s;
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld%lld",&a,&b,&k);
		s=gcd(a,b);
		if(a==b)
			printf("OBEY\n");
		if(a>b)
		{
			c=(a-s)/b+1;
			st=2*a/b;
			if(st*b==2*a)
			{
				if(c-1>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
			else{
				if(c>=k)
					printf("REBEL\n");
				else
					printf("OBEY\n");
			}
		}
		if(b>a)
		{
			  c=(b-s)/a+1;
                        st=2*b/a;
                        if(st*s==2*b)
                        {
                                if(c-1>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
                        else{
                                if(c>=k)
                                        printf("REBEL\n");
                                else
                                        printf("OBEY\n");
                        }
		}
	}
	return 0;
}
/*long long int gcd(long long int a,long long int b)
{
	if(a==0)
		return b;
	else
		return (b%a,a);
}*/


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(gcd(g,h)==1)
            if((h-g)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-g-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(g==1) {
            if(h-g-1>=k)
                printf("REBEL");
            else printf("OBEY");
            continue;
        }
        if(gcd(g,h)==1)
            if((h-g-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-g)/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>

int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        long long g,h,k,q,b;
        scanf("%lld%lld%lld",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if((h-g)/g>=k)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if((h-gcd(g,h)-1)/g>=k-1)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>

int main()
{
    int a,b;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if((h-g)/g>=k)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;//
        }
        if(gcd(g,h)==1)
            if((h-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-gcd(g,h))/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if((h-gcd(g,h))/g>=k)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(gcd(g,h)==1)
            if((h-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-g)/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;//ghg
        }
        if(gcd(g,h)==1)
            if((h-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-gcd(g,h))/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(gcd(g,h)==1)
            if((h-g-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-g)/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long a,b;
    scanf("%ld",&a);
    while(a--) {
        long long g,h,k,q;
        scanf("%ld%ld%ld",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        } //
        if((h-g)/g>=k)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if((h-gcd(g,h)-1)/g>=k)
            printf("REBEL");
        else printf("OBEY");
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(gcd(g,h)==1)
            if((h-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-gcd(g,h))/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b) {
    return !b?a:gcd(b,a%b);
}
int main()
{
    int a;
    scanf("%d",&a);
    while(a--) {
        int g,h,k,q,b;
        scanf("%d%d%d",&g,&h,&k);
        if(g>h) {
            b=g;
            g=h;
            h=b;
        }
        if(g==1) {
            if(h-g-1>=k)
                printf("REBEL");
            else printf("OBEY");
            printf("\n");
            continue;
        }
        if(gcd(g,h)==1)
            if((h-g-1)/g>=k)
                printf("REBEL");
            else printf("OBEY");
        else {
            if((h-g)/g>=k)
                printf("REBEL");
            else printf("OBEY");

        }
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int gcd(int a, int b)
{
	int r = a % b;
	while (r > 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
int main()
{
	int t;
	scanf("%d", &t);
	int i;
	int r, b, k;
	for (i = 0; i < t; i++)
	{
		scanf("%d %d %d", &r, &b, &k);
		if (r > b)
		{
			r ^= b;
			b ^= r;
			r ^= b;
		}
		if ((b - gcd(r, b) + r - 1) / r >= k)
			printf("REBEL\n");
		else
			printf("OBEY\n");
	}
	return 0;
}


#include<stdio.h>
int gcd(int a, int b)
{
	int r = a % b;
	while (r > 0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
int main()
{
	int t;
	scanf("%d", &t);
	int i;
	int r, b, k;
	for (i = 0; i < t; i++)
	{
		scanf("%d %d %d", &r, &b, &k);
		if (r > b)
		{
			r ^= b;
			b ^= r;
			r ^= b;
		}
		if ((b - gcd(r, b)) / r >= k)
			printf("REBEL\n");
		else
			printf("OBEY\n");
	}
	return 0;
}


#include <stdio.h>
long long GCD(long long a, long long b)
{
	long long c;
	while (b)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main()
{
	int T;
	int t;
	long long r, b, k;
	long long temp;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%I64d %I64d %I64d", &r, &b, &k);
		t = GCD(r, b);
		if (r < b)
		{
			temp = r;
			r = b;
			b = temp;
		}
		r -= t;
		if (r % b)
		{
			r /= b;
			r++;
		}
		else
		{
			r /= b;
		}
		if (r >= k)
		{
			printf("REBEL\n");
		}
		else
		{
			printf("OBEY\n");
		}
	}
	return 0;
}


#include <stdio.h>
long long GCD(long long a, long long b)
{
	long long c;
	while (b)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main()
{
	int T;
	int t;
	long long r, b, k;
	long long temp;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%I64d %I64d %I64d", &r, &b, &k);
		t = GCD(r, b);
		if (r < b)
		{
			temp = r;
			r = b;
			b = temp;
		}
		r -= t;
		r /= b;
		if (r >= k)
		{
			printf("REBEL\n");
		}
		else
		{
			printf("OBEY\n");
		}
	}
	return 0;
}


#include <stdio.h>

//a > b
long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    else return gcd(b, a%b);
}

int main() {
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        long long r, b, k;
        scanf("%lld%lld%lld", &r, &b, &k);
        if (r < b) {long long t = r; r = b; b = t;}
        long long d = gcd(r, b);
        long long max_k = ((r-d) % b) == 0 ? (r - d) / b : (r - b) / b + 1;

        if (max_k >= k)
            printf("REBEL\n");
        else
            printf("OBEY\n");

    }

    return 0;
}


#include <stdio.h>

//a > b
long long gcd(long long a, long long b) {
    if (a % b == 0) return b;
    else return gcd(b, a%b);
}

int main() {
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        long long r, b, k;
        scanf("%lld%lld%lld", &r, &b, &k);
        if (r < b) {long long t = r; r = b; b = t;}
        long long d = gcd(r, b);
        long long max_k = ((r-d) % b) == 0 ? (r - d) / b : (r - d) / b + 1;

        if (max_k >= k)
            printf("REBEL\n");
        else
            printf("OBEY\n");

    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>

typedef long long int NB;
#define NBS "%lld"

#define pf printf
#define pn(a) pf(NBS"\n", a)
#define pnc(a) pf("%c", a)
#define sf scanf
#define sn(x) scanf(NBS, x)
#define sfc(x) scanf(" %c", x)
#define so(x) sizeof(x)
#define len(x) so(x)/so(*x)
#define fr(i, x) for(NB i = 0; i < x; ++i)

void _pns(NB n, NB *p){if(n == 1)pn(*p);else {pf(NBS" ", *p);_pns(n-1, p+1);}}
#define pns(a1,...) {NB _a[]={a1, __VA_ARGS__}; _pns(len(_a), _a);}while(0)

NB SN_S, SN_L;
void _sns(NB n, NB **p){SN_L = sn(*p); if(SN_L <= 0) return; SN_S += SN_L; if(n > 1) _sns(n-1, p+1);}
#define sns(a1,...) {NB *_a[]={a1, __VA_ARGS__}; SN_S = 0; _sns(len(_a), _a);}while(0)

NB cmp(const void * ap, const void * bp){
    NB a = *(const NB *)ap;
    NB b = *(const NB *)bp;
    return (a > b) - (a < b);
}

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

void swap (NB * a, NB * b){
    NB tmp = *a;
    *a = *b;
    *b = tmp;
}

NB rndUp(NB numer, NB denom){
    NB base = numer / denom;
    if(base * denom < numer-1) return base + 1;
    return base;
}

void solve(){
    NB r,b, k;
    sns(&r, &b, &k);
    if(r < b) swap(&r, &b);
    NB g = gcd(r, b);
    r /= g; b /=g;
    NB res = r % b == 0 ? r-1 : rndUp(r, b);
    if( res < k) pf("OBEY\n");
    else pf("REBEL\n");
}

int main(void){
    NB n;
    sn(&n);
    fr(i, n) solve();
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

typedef long long int NB;
#define NBS "%lld"

#define pf printf
#define pn(a) pf(NBS"\n", a)
#define pnc(a) pf("%c", a)
#define sf scanf
#define sn(x) scanf(NBS, x)
#define sfc(x) scanf(" %c", x)
#define so(x) sizeof(x)
#define len(x) so(x)/so(*x)
#define fr(i, x) for(NB i = 0; i < x; ++i)

void _pns(NB n, NB *p){if(n == 1)pn(*p);else {pf(NBS" ", *p);_pns(n-1, p+1);}}
#define pns(a1,...) {NB _a[]={a1, __VA_ARGS__}; _pns(len(_a), _a);}while(0)

NB SN_S, SN_L;
void _sns(NB n, NB **p){SN_L = sn(*p); if(SN_L <= 0) return; SN_S += SN_L; if(n > 1) _sns(n-1, p+1);}
#define sns(a1,...) {NB *_a[]={a1, __VA_ARGS__}; SN_S = 0; _sns(len(_a), _a);}while(0)

NB cmp(const void * ap, const void * bp){
    NB a = *(const NB *)ap;
    NB b = *(const NB *)bp;
    return (a > b) - (a < b);
}

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

void swap (NB * a, NB * b){
    NB tmp = *a;
    *a = *b;
    *b = tmp;
}

NB rndUp(NB numer, NB denom){
    NB base = numer / denom;
    if(base * denom < numer - 1) return base + 1;
    return base;
}

void solve(){
    NB r,b, k;
    sns(&r, &b, &k);
    if(r < b) swap(&r, &b);
    NB g = gcd(r, b);
    r /= g; b /=g;
    NB res = rndUp(r, b);
    if( res < k) pf("OBEY\n");
    else pf("REBEL\n");
}

int main(void){
    NB n;
    sn(&n);
    fr(i, n) solve();
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

typedef long long int NB;
#define NBS "%lld"

#define pf printf
#define pn(a) pf(NBS"\n", a)
#define pnc(a) pf("%c", a)
#define sf scanf
#define sn(x) scanf(NBS, x)
#define sfc(x) scanf(" %c", x)
#define so(x) sizeof(x)
#define len(x) so(x)/so(*x)
#define fr(i, x) for(NB i = 0; i < x; ++i)

void _pns(NB n, NB *p){if(n == 1)pn(*p);else {pf(NBS" ", *p);_pns(n-1, p+1);}}
#define pns(a1,...) {NB _a[]={a1, __VA_ARGS__}; _pns(len(_a), _a);}while(0)

NB SN_S, SN_L;
void _sns(NB n, NB **p){SN_L = sn(*p); if(SN_L <= 0) return; SN_S += SN_L; if(n > 1) _sns(n-1, p+1);}
#define sns(a1,...) {NB *_a[]={a1, __VA_ARGS__}; SN_S = 0; _sns(len(_a), _a);}while(0)

NB cmp(const void * ap, const void * bp){
    NB a = *(const NB *)ap;
    NB b = *(const NB *)bp;
    return (a > b) - (a < b);
}

void swap (NB * a, NB * b){
    NB tmp = *a;
    *a = *b;
    *b = tmp;
}

NB rndUp(NB numer, NB denom){
    NB base = numer / denom;
    if(base * denom < numer) return base + 1;
    return base;
}

void solve(){
    NB r,b, k;
    sns(&r, &b, &k);
    if(r < b) swap(&r, &b);
    NB res = rndUp(r, b);
    if( res < k) pf("OBEY\n");
    else pf("REBEL\n");
}

int main(void){
    NB n;
    sn(&n);
    fr(i, n) solve();
    return 0;
}


#include<stdio.h>
#define lli long long int
lli gcd(lli a, lli b)
{
	if(!a)
		return b;
	return gcd(b % a, a);
}
lli lcm(lli a, lli b)
{
	return (a*b)/gcd(a, b);
}
int main(void)
{
	lli t;
	scanf("%lld",&t);
	while(t--)
	{
		lli b,r,k,l,n1,n2,M,m;
		scanf("%lld %lld %lld", &b, &r, &k);
		l=lcm(r,b);
		n1=l/r-1;
		n2=l/b-1;
		if(n1>n2)
			M=n1;
		else
			M=n2;

		m=n1+n2-M;

		if((M/(m+1) + M%(m+1))>=k)
			printf("REBEL\n");
		else
			printf("OBEY\n");
	}

	return 0;
}


#include<stdio.h>
#define lli long long int
lli gcd(lli a, lli b)
{
	if(!a)
		return b;
	return gcd(b % a, a);
}
lli lcm(lli a, lli b)
{
	return (a*b)/gcd(a, b);
}
int main(void)
{
	lli t;
	scanf("%lld",&t);
	while(t--)
	{
		lli b,r,k,l,n1,n2,M,m,n;
		scanf("%lld %lld %lld", &b, &r, &k);
		l=lcm(r,b);
		n1=l/r-1;
		n2=l/b-1;
		if(n1>n2)
			M=n1;
		else
			M=n2;

		m=n1+n2-M;

		n=M/(m+1);

		if(M%(m+1))
			n++;

		if(n>=k)
			printf("REBEL\n");
		else
			printf("OBEY\n");
	}

	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(a==b) return 1;
	if((a-2)/b+((a-2)%b==0?0:1)>=k) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(b==1 || a==b) return 1;
	if(a/b-(a%b==0?1:0)>=k) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(b==1) return 1;
	if(a/b-(a%b==0)<k) return 1;
	return 0;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(b==1 || a==b) return 1;
	if(a/b-(a%b==0?1:0)>=k || (a-1>b && k==2)) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(a==b) return 1;
	if((a-1)/b+((a-1)%b==0?0:1)>=k) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

int gcd(int a, int b){
	int c;
	while(b){
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}

_Bool obey(){
	int a, b, k, g;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	g=gcd(a, b);
	a/=g;
	b/=g;
	if(a==b) return 1;
	if((a-1)/b+((a-1)%b==0?0:(a%b?1:0))>=k) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include<stdio.h>

_Bool obey(){
	int a, b, k;
	scanf("%d %d %d", &a, &b, &k);
	if(a<b){ int c=a; a=b; b=c; }
	if(a==b) return 1;
	if((a-1)/b+((a-1)%b==0?0:(a%b?1:0))>=k) return 0;
	return 1;
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) puts(obey()?"OBEY":"REBEL");
	return 0;
}


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

/*
typedef struct {

}  ;
*/

long long min(long long a, long long b)
{
    if (a < b)
        return a;
    else
        return b;
}

long long max(long long a, long long b)
{
    if (a < b)
        return b;
    else
        return a;
}

int compare(const long long * a, const long long * b)
{
    return ( *a > *b ) - ( *a < *b );
}

int main ( int argc, char * argv[] )
{
    long long t;
    long long ans;
    scanf("%lld", &t);

    for (int i =0 ; i < t; i++)
    {
        long long r, b , k;
        scanf("%lld%lld%lld", &r, &b, &k);
        if (b <= r)
        {
            long long change = b;
            b = r;
            r = change;
        }
        if (b <= (k - 1) * r)
            printf("OBEY\n");
        else if (b > k * r)
            printf("REBEL\n");
        else if (b == k * r)
            printf("OBEY\n");
        else
        {
            long long calc = b - (k - 1) * r;
            if ((r - calc) % calc == 0)
                printf("OBEY\n");
            else
                printf("REBEL\n");
        }

    }

    return 0;
}


#include<stdio.h>

int main()
{

int t=0,k=0,r=0,b=0,sp;

scanf("%d",&t);

while(t--)
{
scanf("%d %d %d",&r,&b,&k);

if(b>r){sp=r; r=b; b=sp;}

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

}

return 0;
}


#include<stdio.h>

int main()
{

	int t=0,k=0,r=0,b=0,sp;

	scanf("%d",&t);

	while(t--)
	{
		scanf("%d %d %d",&r,&b,&k);

		if(b>r){sp=r; r=b; b=sp;}

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

	}

	return 0;
}


#include<stdio.h>

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

int main()
{

	int g,t=0,k=0,r=0,b=0,sp;

	scanf("%d",&t);

	while(t--)
	{
		scanf("%d %d %d",&r,&b,&k);

		if(b>r){sp=r; r=b; b=sp;}

    g= gcd(r,b);
    if(g>1)
      {r=r/g; b=b/g;}

		if(b==1)
		{
			if(k<= (r - 1))
				printf("REBEL\n");
			else
				printf("OBEY\n");
		}
		else
		{
			if(k<= ((r-2)/b + 1))
				printf("REBEL\n");
			else
				printf("OBEY\n");
		}

	}

	return 0;
}


#include<stdio.h>

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

int main()
{

	int g,t=0,k=0,r=0,b=0,sp;

	scanf("%d",&t);

	while(t--)
	{
		scanf("%d %d %d",&r,&b,&k);

		if(b>r){sp=r; r=b; b=sp;}

    g= gcd(r,b);
    if(g>1)
      {r=r/g; b=b/g;}

		if(r%b==0)
		{
			if(k<= g*(r/b - 1))
				printf("REBEL\n");
			else
				printf("OBEY\n");
		}
		else
		{
			if(k<= g*((r-2)/b + 1))
				printf("REBEL\n");
			else
				printf("OBEY\n");
		}

	}

	return 0;
}


#include <stdio.h>
#include <stdlib.h>

 long long int gcd(long long int a, long long int b) {
    if (a % b == 0)
        return b;
    else if (b % a == 0)
        return a;
    return gcd(a % b, b % a);
 }
 int main() {
    long long int t, r1, b1, r, b, k, i, c, d;
    scanf("%I64d", &t);
    for (i = 0; i < t; i++) {
        scanf("%I64d%I64d%I64d", &r1, &b1, &k);
        if (r1 > b1) {
            r = r1;
            b = b1;
        }
        else {
            r = b1;
            b = r1;
        }
        d = gcd(r, b);
        if ((k-1) * r + d >= b)
            printf("OBEY\n");
        else
            printf("REBEL\n");

        /*if (r > b) {
            c = r / b;
            if (r % b != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else if (b > r) {
            c = b / r;
            if (b % r != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else
            printf("OBEY\n");*/
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
    long long int t, r, b, k, i, c;
    scanf("%I64d", &t);
    for (i = 0; i < t; i++) {
        scanf("%I64d%I64d%I64d", &r, &b, &k);
        if (r > b) {
            c = r / b;
            if (r % b != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c <= k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else if (b > r) {
            c = b / r;
            if (b % r != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c <= k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else
            printf("OBEY\n");
    }
    return 0;
}