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].
/*
 * Author Ayub Subhaniya
 * Institute DA-IICT
 */

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

public class Tester
{

    InputStream in;
    PrintWriter out;

    long mod=(long)1e9+7;
    int MAX=(int)1e6+7;
    double eps=1e-6;

    void solve()
    {
        int n=ni();
        Pair p[]=new Pair[4*n];
        for (int i=0;i<n;i++)
        {
            p[i]=new Pair(ni(),0,i);
            p[n+i]=new Pair(ni(),1,i);
            p[2*n+i]=new Pair(p[i].x-1,2,-1);
            p[3*n+i]=new Pair(p[n+i].x+1,2,-1);
        }
        Arrays.sort(p);
        HashSet<Integer> active=new HashSet<>();
        boolean nonR[]=new boolean[n];
        //tr(p);
        for (int i=0;i<p.length;)
        {
            int j=i;
            boolean flag = false;
            while (j<p.length&&p[j].x==p[i].x)
            {
                if (active.size()>1)
                    flag=true;

                //tr(p[j]);
                if (p[j].y==0)
                {
                    active.add(p[j].z);
                }
                else if (p[j].y == 1)
                {
                     if (!flag&&active.size()==1) {
                        for (int x:active)
                            nonR[x]=true;
                    }
                    active.remove(p[j].z);
                }
                else
                {
                    if (!flag&&active.size()==1)
                    {
                        for (int x:active)
                            nonR[x]=true;
                    }
                }
                //tr(p[j].x,active);
                j++;
            }
            //tr(active);
            i=j;
            if (!flag&&active.size()==1)
                for (int x:active)
                    nonR[x]=true;
            //tr(nonR);
        }
        for (int i=0;i<n;i++)
            if (!nonR[i])
            {
                out.println(i+1);
                return;
            }
        out.println(-1);
    }

    class Pair implements Comparable<Pair>
    {
        int x;
        int y;
        int z;
        Pair(int a,int b,int c)
        {
            x=a;
            y=b;
            z=c;
        }

        @Override
        public boolean equals(Object o)
        {
            Pair other = (Pair)o;
            return x == other.x && y == other.y;
        }
        public String toString()
        {
            return x+" "+y+" "+z;
        }

        @Override
        public int compareTo(Pair o)
        {
            if (x==o.x)
                return Integer.compare(y, o.y);
            else
                return Integer.compare(x, o.x);
        }
        @Override public int hashCode()
        {
            return Objects.hash(x, y);
        }
    }

    long pow(long x, long n, long M) {
        x%=M;
        long result = 1;
        while (n > 0) {
            if (n % 2 == 1)
                result = (result * x) % M;
            x = (x * x) % M;
            n = n / 2;
        }
        return result;
    }

    long modInverse(long A, long M) {
        extendedEuclid(A, M);
        return (EEx % M + M) % M;
    }
    long EEd, EEx, EEy;

    void extendedEuclid(long A, long B) {
        if (B == 0) {
            EEd = A;
            EEx = 1;
            EEy = 0;
        } else {
            extendedEuclid(B, A % B);
            long temp = EEx;
            EEx = EEy;
            EEy = temp - (A / B) * EEy;
        }
    }

    int max(int a,int b)
    {
        if(a>b)
            return a;
        else
            return b;
    }

    int min(int a,int b)
    {
        if(a>b)
            return b;
        else
            return a;
    }

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

    }


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

    }

    long add(long a,long b)
    {
        long x=(a+b);
        while(x>=mod) x-=mod;
        return x;

    }


    long sub(long a,long b)
    {
        long x=(a-b);
        while(x<0) x+=mod;
        return x;

    }


    long mul(long a,long b)
    {
        a%=mod;
        b%=mod;
        long x=(a*b);
        return x%mod;

    }

    void run() throws Exception
    {
        String INPUT = "/Users/ayubsubhaniya/IdeaProjects/Test/src/input.txt";
        in = oj ? System.in : new FileInputStream(INPUT);
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        tr(System.currentTimeMillis() - s + "ms");

    }
    public static void main(String[] args) throws Exception
    {
        new Tester().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if (lenbuf == -1)
            throw new InputMismatchException();
        if (ptrbuf >= lenbuf)
        {
            ptrbuf = 0;
            try
            {
                lenbuf = in.read(inbuf);
            }
            catch (IOException e)
            {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0)
                return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean inSpaceChar(int c)
    {
        return !(c >= 33 && c <= 126);
    }

    private int skip()
    {
        int b;
        while ((b = readByte()) != -1 && inSpaceChar(b))
            ;
        return b;
    }

    private double nd()
    {
        return Double.parseDouble(ns());
    }

    private char nc()
    {
        return (char) skip();
    }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(inSpaceChar(b)))
        { // when nextLine, (inSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(inSpaceChar(b)))
        {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++)
            map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
            ;
        if (b == '-')
        {
            minus = true;
            b = readByte();
        }

        while (true)
        {
            if (b >= '0' && b <= '9')
            {
                num = num * 10 + (b - '0');
            }
            else
            {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
            ;
        if (b == '-')
        {
            minus = true;
            b = readByte();
        }

        while (true)
        {
            if (b >= '0' && b <= '9')
            {
                num = num * 10 + (b - '0');
            }
            else
            {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o)
    {
        if (!oj)
            System.out.println(Arrays.deepToString(o));
    }

}

