Luba needs your help again! Luba has n TV sets. She knows that i-th TV set will be working from moment of time li till moment ri, inclusive.

Luba wants to switch off one of TV sets in order to free the socket. Let's call some TV set redundant if after switching it off the number of integer moments of time when at least one of TV sets is working won't decrease. Luba will be very upset if she has to switch off a non-redundant TV set.

Help Luba by telling her the index of some redundant TV set. If there is no any, print -1.

Input

The first line contains one integer number n (1 ≤ n ≤ 2·105) — the number of TV sets.

Then n lines follow, each of them containing two integer numbers li, ri (0 ≤ li ≤ ri ≤ 109) denoting the working time of i-th TV set.

Output

If there is no any redundant TV set, print -1. Otherwise print the index of any redundant TV set (TV sets are indexed from 1 to n).

If there are multiple answers, print any of them.

Examples

Input

3
1 3
4 6
1 7


Output

1


Input

2
0 10
0 10


Output

1


Input

3
1 2
3 4
6 8


Output

-1


Input

3
1 2
2 3
3 4


Output

2

Note

Consider the first sample. Initially all integer moments of time such that at least one TV set is working are from the segment [1;7]. It's easy to see that this segment won't change if we switch off the first TV set (or the second one).

Note that in the fourth sample you can switch off the second TV set, since even without it all integer moments such that any of the TV sets is working denote the segment [1;4].
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author svilen.marchev@gmail.com
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputStreamReader in = new InputStreamReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskE solver = new TaskE();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskE {

    final int N = 1 << 20;
    List<TaskE.Ival> ivals;
    int n;
    TaskE.Node[] tree = new TaskE.Node[2 * N];

    void insertIval(int nodeIx, int treeL, int treeR, TaskE.Ival ival) {
      if (ival.l <= treeL && treeR <= ival.r) {
        tree[nodeIx].timesCovered += 1;
        return;
      }
      int treeM = (treeL + treeR) / 2;
      if (ival.l <= treeM) {
        insertIval(nodeIx * 2, treeL, treeM, ival);
      }
      if (treeM + 1 <= ival.r) {
        insertIval(nodeIx * 2 + 1, treeM + 1, treeR, ival);
      }
    }

    void updateTree(int nodeIx, int treeL, int treeR, int timesCoveredByUpperNodes) {
      if (treeL == treeR) {
        tree[nodeIx].minimallyCoveredSection = tree[nodeIx].timesCovered + timesCoveredByUpperNodes;
        return;
      }
      int treeM = (treeL + treeR) / 2;
      updateTree(nodeIx * 2, treeL, treeM, timesCoveredByUpperNodes + tree[nodeIx].timesCovered);
      updateTree(nodeIx * 2 + 1, treeM + 1, treeR,
          timesCoveredByUpperNodes + tree[nodeIx].timesCovered);

      tree[nodeIx].minimallyCoveredSection = Math.min(tree[2 * nodeIx].minimallyCoveredSection,
          tree[2 * nodeIx + 1].minimallyCoveredSection);
    }

    int query(int nodeIx, int treeL, int treeR, TaskE.Ival ival) {
      if (ival.l <= treeL && treeR <= ival.r) {
        return tree[nodeIx].minimallyCoveredSection;
      }
      int val = Integer.MAX_VALUE;
      int treeM = (treeL + treeR) / 2;
      if (ival.l <= treeM) {
        val = Math.min(val, query(nodeIx * 2, treeL, treeM, ival));
      }
      if (treeM + 1 <= ival.r) {
        val = Math.min(val, query(nodeIx * 2 + 1, treeM + 1, treeR, ival));
      }
      return val;
    }

    public void solve(int testNumber, InputStreamReader in, PrintWriter out) {
      SvLogger log = new SvLogger().setPrintTimeEllapsed(true).setEnabled(false);

//    SimpleSolver simpleSolver = new SimpleSolver();

      SvScanner sc = new SvScanner(in);
      n = sc.nextInt();
      ivals = new ArrayList<>(n);
      List<Integer> uncompressedCoords = new ArrayList<>(2 * n);
      for (int i = 0; i < n; ++i) {
        TaskE.Ival ival = new TaskE.Ival();
        ival.l = sc.nextInt();
        ival.r = sc.nextInt();
        ivals.add(ival);

        uncompressedCoords.add(ival.l);
        uncompressedCoords.add(ival.r);
        // very important!, so that [1,2],[3,4] is compressed differently than [1,2],[4,5]
        uncompressedCoords.add(ival.l - 1);
      }
      log.p("input read");
      ArrayList<Integer> deduped = new ArrayList<>(new HashSet<>(uncompressedCoords));
      log.p("built deduped");
      Collections.sort(deduped);
      log.p("sorted deduped");
      // Remap coords to compress
      for (int i = 0; i < n; ++i) {
        ivals.get(i).l = Collections.binarySearch(deduped, ivals.get(i).l);
        ivals.get(i).r = Collections.binarySearch(deduped, ivals.get(i).r);
//      simpleSolver.add(ivals.get(i).l, ivals.get(i).r);
//      out.println(ivals.get(i).l +" "+ivals.get(i).r);
      }
      log.p("compressed");

      // Build tree and add all ivals
      for (int i = 1; i < 2 * N; ++i) {
        tree[i] = new TaskE.Node();
      }
      for (int i = 0; i < n; ++i) {
        insertIval(1, 0, N - 1, ivals.get(i));
      }
      log.p("ivals added");

      // Build the minimally covered value for each node
      updateTree(1, 0, N - 1, 0);
      log.p("tree updated");

//    Ival iv = new Ival();
//    iv.l = 0;
//    iv.r = 2;
//    out.println("! " + query(1, 0, N - 1, iv));

//    for (int l = 0; l < 1000; ++l) {
//      for (int r=l; r< 1000; ++r) {
//        int resSimple = simpleSolver.query(l, r);
//        Ival ival = new Ival();
//        ival.l = l;
//        ival.r = r;
//        int resFast = query(1, 0, N-1, ival);
//
//        if (resSimple != resFast) {
//          log.p("!!! mismatched %d %d", resSimple, resFast);
//        }
//      }
//    }

      // Check by how many other ivals each ival is covered. If more than 1, it can be an answer.
      for (int i = 0; i < n; ++i) {
        int minimallyCoveredSection = query(1, 0, N - 1, ivals.get(i));
//      out.println(ivals.get(i).l + "," + ivals.get(i).r + " -> " + minimallyCoveredSection);
        if (minimallyCoveredSection > 1) {
          out.println(i + 1);
          return;
        }
      }
      out.println("-1");
      log.p("ivals checked");
    }

    static class Ival {

      int l;
      int r;

    }

    static class Node {

      int timesCovered;
      int minimallyCoveredSection;

    }

  }

  static class SvLogger {

    private static final String MESSAGE_PREFIX = "> ";
    private boolean enabled = true;
    private boolean printTimeEllapsed = false;
    private long startedTime = System.currentTimeMillis();

    public SvLogger setEnabled(boolean enabled) {
      this.enabled = enabled;
      return this;
    }

    public SvLogger setPrintTimeEllapsed(boolean printTimeEllapsed) {
      this.printTimeEllapsed = printTimeEllapsed;
      return this;
    }

    public void p(String format, Object... args) {
      if (!enabled) {
        return;
      }
      String formattedTime =
          printTimeEllapsed ? " (" + (System.currentTimeMillis() - startedTime) + " ms)" : "";
      System.out.println(MESSAGE_PREFIX + String.format(format, args) + formattedTime);
    }

  }

  static class SvScanner {

    private BufferedReader reader;
    private StringTokenizer tokenizer = new StringTokenizer("");

    public SvScanner(InputStreamReader in) {
      reader = new BufferedReader(in);
    }

    public String next() {
      try {
        while (!tokenizer.hasMoreTokens()) {
          String nextLine = reader.readLine();
          if (nextLine == null) {
            throw new IllegalStateException("next line is null");
          }
          tokenizer = new StringTokenizer(nextLine);
        }
        return tokenizer.nextToken();
      } catch (IOException e) {
        throw new IllegalStateException(e);
      }
    }

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

  }
}

