package timus.neerc.eastern2013;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

// @todo WA 9
public class H {

    private BufferedReader br;
    private PrintWriter out;
    private StringTokenizer st;

    public H() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

    }

    public static void main(String[] args) throws IOException {
        new H().solve();
    }

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

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

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

    private void solve() throws IOException {
        final int a = nextInt();
        final int b = nextInt();
        final int nn = nextInt();
        if(nn % 2 == 1) {
             out.println("Liar");
            out.flush();;
            return;
        }
        final int n = nn / 2;
        final int[] enter = new int[n];
        final int[] exit = new int[n];
        int pos1 = 0;
        int pos2 = 0;
        Set<Integer> times = new HashSet<>();
        for (int i = 0; i < n * 2; ++i) {
            int time = nextInt();
            int type = nextInt();
            times.add(time);
            if (type == 0) {
                if(pos1 == n) {
                    out.println("Liar");
                    out.flush();;
                    return;
                }
                enter[pos1++] = time;
            } else {
                if(pos2 == n) {
                    out.println("Liar");
                    out.flush();;
                    return;
                }
                exit[pos2++] = time;
            }
        }
        if(times.size() != 2 * n) {
            String x = null;
            out.println(x.length());
        }
        class Utils {
            int[] prev = new int[n];
            boolean[] used = new boolean[n];

            boolean findChain(int u) {
                used[u] = true;
                for (int v = 0; v < n; ++v) {
//                    if (exit[v] < enter[u])
//                        continue;
//                    if (exit[v] - enter[u] > b) {
//                        break;
//                    }
                    int spent = exit[v] - enter[u];
                    if(spent < 0 ||  spent > b && spent < a) {
                        continue;
                    }
                    if (prev[v] == -1 || !used[prev[v]] && findChain(prev[v])) {
                        prev[v] = u;
                        return true;
                    }
                }
         /*       for (int v = n - 1; v >= 0; --v) {
                    if (exit[v] - enter[u] < a) {
                        break;
                    }
                    if (prev[v] == -1 || !used[prev[v]] && findChain(prev[v])) {
                        prev[v] = u;
                        return true;
                    }
                }*/
                return false;
            }

            boolean maxMatch() {
                Arrays.fill(prev, -1);
                for (int u = 0; u < n; ++u) {
                    Arrays.fill(used, false);
                    if (!findChain(u)) {
                        return false;
                    }
                }
                return true;
            }
        }
        Utils u = new Utils();
        if (!u.maxMatch()) {
            out.println("Liar");
        } else {
            out.println("No reason");
            for (int i = 0; i < n; ++i) {
                out.println(enter[i] + " " + exit[u.prev[i]]);
            }
        }
        out.flush();
    }

}

@@ -177,56 +177,8 @@
 ys;%0A
-import java.util.HashSet;%0Aimport java.util.Set;%0A
 impo
@@ -212,22 +212,8 @@
 r;%0A%0A
-// @todo WA 9%0A
 publ
@@ -1087,17 +1087,16 @@
 al int n
-n
  = nextI
@@ -1103,150 +1103,8 @@
 nt()
-;%0A        if(nn %25 2 == 1) %7B%0A             out.println(%22Liar%22);%0A            out.flush();;%0A            return;%0A        %7D%0A        final int n = nn
  / 2
@@ -1232,54 +1232,8 @@
  0;%0A
-        Set%3CInteger%3E times = new HashSet%3C%3E();%0A
     
@@ -1342,37 +1342,8 @@
 ();%0A
-            times.add(time);%0A
     
@@ -1387,519 +1387,101 @@
     
-if(pos1 == n) %7B%0A                    out.println(%22Liar%22);%0A                    out.flush();;%0A                    return;%0A                %7D%0A                enter%5Bpos1++%5D = time;%0A            %7D else %7B%0A                if(pos2 == n) %7B%0A                    out.println(%22Liar%22);%0A                    out.flush();;%0A                    return;%0A                %7D%0A                exit%5Bpos2++%5D = time;%0A            %7D%0A        %7D%0A        if(times.size() != 2 * n) %7B%0A            String x = null;%0A            out.println(x.length());
+enter%5Bpos1++%5D = time;%0A            %7D else %7B%0A                exit%5Bpos2++%5D = time;%0A            %7D
 %0A   
@@ -1713,199 +1713,8 @@
 ) %7B%0A
-//                    if (exit%5Bv%5D %3C enter%5Bu%5D)%0A//                        continue;%0A//                    if (exit%5Bv%5D - enter%5Bu%5D %3E b) %7B%0A//                        break;%0A//                    %7D%0A
     
@@ -1783,16 +1783,17 @@
       if
+ 
 (spent %3C
@@ -1797,17 +1797,16 @@
 t %3C 0 %7C%7C
- 
  spent %3E
@@ -2079,361 +2079,8 @@
   %7D%0A
-         /*       for (int v = n - 1; v %3E= 0; --v) %7B%0A                    if (exit%5Bv%5D - enter%5Bu%5D %3C a) %7B%0A                        break;%0A                    %7D%0A                    if (prev%5Bv%5D == -1 %7C%7C !used%5Bprev%5Bv%5D%5D && findChain(prev%5Bv%5D)) %7B%0A                        prev%5Bv%5D = u;%0A                        return true;%0A                    %7D%0A                %7D*/%0A
     
@@ -2680,17 +2680,25 @@
 n(enter%5B
-i
+u.prev%5Bi%5D
 %5D + %22 %22 
@@ -2704,25 +2704,17 @@
  + exit%5B
-u.prev%5Bi%5D
+i
 %5D);%0A    
@@ -2762,9 +2762,8 @@
     %7D%0A%0A%7D
-%0A

Add proper H solution