import ru.ifmo.validate.*;
import java.util.*;

public class Validate implements Validator {
  final static int MAX_N = 100000;
  final static int MAX_A = 10000;
  
  @Override
  public void validate(ValidatingScanner in) {
    int n = in.nextInt(1, MAX_N);
    int l = in.nextInt(1, n);
    int r = in.nextInt(l, n);
    in.eoln();

    for (int i = 0; i < n; ++i) {
      int a = in.nextInt(0, MAX_A);
      int b = in.nextInt(0, MAX_A);
      in.eoln();
    }

    int[] sum = new int[n + 1];
    sum[0] = 1;
    for (int i = 1; i <= n; ++i) {
      int x = (i >= r + 1 ? sum[i - r - 1] : 0);
      int y = (i >= l ? sum[i - l] : 0);
      sum[i] = sum[i - 1] + (y > x ? 1 : 0);
    }
    ensure(sum[n] > sum[n - 1], "There is no valid group splitting");
  }
  
  void ensure(boolean b, String message) {
    if (!b) {
      throw new AssertionError(message);
    }
  }
}

