import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.Set;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeMap;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
import java.util.regex.Pattern;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author amalev
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();

            TreeMap<TaskC.Segment, Integer> lmap = new TreeMap<>((a, b) -> {
                int c = Integer.compare(a.l, b.l);
                if (c != 0) {
                    return c;
                } else {
                    return -Integer.compare(a.r, b.r);
                }
            });

            TreeMap<TaskC.Segment, Integer> rmap = new TreeMap<>((a, b) -> {
                int c = Integer.compare(a.r, b.r);
                if (c != 0) {
                    return c;
                } else {
                    return -Integer.compare(a.l, b.l);
                }
            });

            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                TaskC.Segment s = new TaskC.Segment(l, r);
                if (lmap.containsKey(s)) {
                    int j = lmap.get(s);
                    out.print(i + 1);
                    out.print(" ");
                    out.print(j + 1);
                    return;
                } else {
                    lmap.put(s, i);
                    rmap.put(s, i);
                }
            }

            lmap.entrySet().iterator();
            for (Iterator<Map.Entry<TaskC.Segment, Integer>> it = lmap.entrySet().iterator(); it.hasNext(); ) {
                Map.Entry<TaskC.Segment, Integer> entryL = it.next();
                it.remove();
                rmap.remove(entryL.getKey());
                Map.Entry<TaskC.Segment, Integer> entryS = rmap.lowerEntry(entryL.getKey());
                if (entryS != null) {
                    out.print(entryS.getValue() + 1);
                    out.print(" ");
                    out.print(entryL.getValue() + 1);
                    return;
                }
            }
            out.print(-1);
            out.print(" ");
            out.print(-1);
        }

        static class Segment {
            final int l;
            final int r;

            Segment(int l, int r) {
                this.l = l;
                this.r = r;
            }

        }

    }

    static class FastScanner {
        final BufferedReader input;
        String[] buffer;
        int pos;
        final static Pattern SEPARATOR = Pattern.compile("\\s+");

        public FastScanner(InputStream inputStream) {
            input = new BufferedReader(new InputStreamReader(inputStream));
        }

        private String[] readAndSplit() {
            try {
                return SEPARATOR.split(input.readLine());
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }

        private String readToBuffer() {
            if (buffer == null || pos >= buffer.length) {
                buffer = readAndSplit();
                pos = 0;
            }
            return buffer[pos++];
        }

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

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.regex.Pattern;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author amalev
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();

            TreeSet<TaskC.Segment> lset = new TreeSet<>((a, b) -> {
                int c = Integer.compare(a.l, b.l);
                if (c != 0) {
                    return c;
                } else {
                    c = -Integer.compare(a.r, b.r);
                    if (c != 0) {
                        return c;
                    } else {
                        return Integer.compare(a.i, b.i);
                    }
                }
            });

            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                lset.add(new TaskC.Segment(l, r, i));
            }

            TaskC.Segment a = null, b = null;
            for (Iterator<TaskC.Segment> it = lset.iterator(); it.hasNext(); ) {
                a = b;
                b = it.next();
                if (a == null || b == null) continue;
                if (a.r >= b.r) {
                    out.print(b.i + 1);
                    out.print(" ");
                    out.print(a.i + 1);
                    return;
                }
            }
            out.print("-1 -1");
        }

        static class Segment {
            final int l;
            final int r;
            final int i;

            Segment(int l, int r, int i) {
                this.l = l;
                this.r = r;
                this.i = i;
            }

        }

    }

    static class FastScanner {
        final BufferedReader input;
        String[] buffer;
        int pos;
        final static Pattern SEPARATOR = Pattern.compile("\\s+");

        public FastScanner(InputStream inputStream) {
            input = new BufferedReader(new InputStreamReader(inputStream));
        }

        private String[] readAndSplit() {
            try {
                return SEPARATOR.split(input.readLine());
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }

        private String readToBuffer() {
            if (buffer == null || pos >= buffer.length) {
                buffer = readAndSplit();
                pos = 0;
            }
            return buffer[pos++];
        }

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

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.regex.Pattern;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author amalev
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();

            ArrayList<TaskC.Segment> list = new ArrayList<>(n);

            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                list.add(new TaskC.Segment(l, r, i));
            }

            Collections.sort(list, ((a, b) -> {
                int c = Integer.compare(a.l, b.l);
                if (c != 0) {
                    return c;
                } else {
                    c = -Integer.compare(a.r, b.r);
                    if (c != 0) {
                        return c;
                    } else {
                        return Integer.compare(a.i, b.i);
                    }
                }
            }));

            TaskC.Segment a = null, b = null;
            for (Iterator<TaskC.Segment> it = list.iterator(); it.hasNext(); ) {
                a = b;
                b = it.next();
                if (a == null || b == null) continue;
                if (a.r >= b.r) {
                    out.print(b.i + 1);
                    out.print(" ");
                    out.print(a.i + 1);
                    return;
                }
            }
            out.print("-1 -1");
        }

        static class Segment {
            final int l;
            final int r;
            final int i;

            Segment(int l, int r, int i) {
                this.l = l;
                this.r = r;
                this.i = i;
            }

        }

    }

    static class FastScanner {
        final BufferedReader input;
        String[] buffer;
        int pos;
        final static Pattern SEPARATOR = Pattern.compile("\\s+");

        public FastScanner(InputStream inputStream) {
            input = new BufferedReader(new InputStreamReader(inputStream));
        }

        private String[] readAndSplit() {
            try {
                return SEPARATOR.split(input.readLine());
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }

        private String readToBuffer() {
            if (buffer == null || pos >= buffer.length) {
                buffer = readAndSplit();
                pos = 0;
            }
            return buffer[pos++];
        }

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

    }
}


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

public class Answer {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Pair> arr = new ArrayList<>();
        TreeSet<Cach> cach = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            arr.add(new Pair(sc.nextInt(), sc.nextInt(), i));
        }
        Collections.sort(arr);
        for (int i = 0; i < arr.size(); i++) {
            Cach temp = cach.ceiling(new Cach(arr.get(i).end,0));
            if (temp != null) {
                System.out.println(arr.get(i).index + " " + temp.location);
                return;
            }
            cach.add(new Cach(arr.get(i).end, i));
        }
        System.out.println("-1 -1");

    }

    static class Pair implements  Comparable<Pair>{
        int start;
        int end;
        int index;

        Pair(int start, int end, int index) {
            this.start = start;
            this.end = end;
            this.index = index + 1;
        }

        @Override
        public int compareTo(Pair o) {
            if(this.start == o.start) {
                return o.end - this.end;
            }
            return this.start - o.start;
        }
    }

    static class Cach implements Comparable<Cach> {
        int end;
        int location;
        Cach(int end, int location) {
            this.end = end;
            this.location = location + 1;
        }
        @Override
        public int compareTo(Cach o) {
            return this.end - o.end;
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream System) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(System));
//            String FILENAME = "level4.txt";
//            br = new BufferedReader(new FileReader(FILENAME));
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

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

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() {
            for (long i = 0; i < 3e9; i++)
                ;
        }
    }
}


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

public class Answer {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Pair> arr = new ArrayList<>();
        TreeSet<Cach> cach = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            arr.add(new Pair(sc.nextInt(), sc.nextInt(), i));
        }
        Collections.sort(arr);
        int maxRight = -1;
        int index = -1;
        for (int i = 0; i < arr.size(); i++) {
           if (maxRight >= arr.get(i).end) {
               System.out.println(arr.get(i).index + " " + index);
               return;
           }
           maxRight = arr.get(i).end;
           index = arr.get(i).index;
        }
        System.out.println("-1 -1");
    }

    static class Pair implements  Comparable<Pair>{
        int start;
        int end;
        int index;

        Pair(int start, int end, int index) {
            this.start = start;
            this.end = end;
            this.index = index + 1;
        }

        @Override
        public int compareTo(Pair o) {
            if(this.start == o.start) {
                return o.end - this.end;
            }
            return this.start - o.start;
        }
    }

    static class Cach implements Comparable<Cach> {
        int end;
        int location;
        Cach(int end, int location) {
            this.end = end;
            this.location = location + 1;
        }
        @Override
        public int compareTo(Cach o) {
            return this.end - o.end;
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream System) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(System));
//            String FILENAME = "level4.txt";
//            br = new BufferedReader(new FileReader(FILENAME));
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

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

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() {
            for (long i = 0; i < 3e9; i++)
                ;
        }
    }
}


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

public class Answer {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Pair> arr = new ArrayList<>();
        TreeSet<Cach> cach = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            arr.add(new Pair(sc.nextInt(), sc.nextInt(), i));
        }
        Collections.sort(arr);
        for (int i = 0; i < arr.size(); i++) {
            Cach temp = cach.ceiling(new Cach(arr.get(i).end,-1));
            if (temp != null) {
                System.out.println(arr.get(i).index + " " + temp.location);
                return;
            }
            cach.add(new Cach(arr.get(i).end, i));
        }
        System.out.println("-1 -1");

    }

    static class Pair implements  Comparable<Pair>{
        int start;
        int end;
        int index;

        Pair(int start, int end, int index) {
            this.start = start;
            this.end = end;
            this.index = index + 1;
        }

        @Override
        public int compareTo(Pair o) {
            if(this.start == o.start) {
                return o.end - this.end;
            }
            return this.start - o.start;
        }
    }

    static class Cach implements Comparable<Cach> {
        int end;
        int location;
        Cach(int end, int location) {
            this.end = end;
            this.location = location + 1;
        }
        @Override
        public int compareTo(Cach o) {
            if (this.end == o.end) return this.location - o.location;
            return this.end - o.end;
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream System) throws FileNotFoundException {
            br = new BufferedReader(new InputStreamReader(System));
//            String FILENAME = "level4.txt";
//            br = new BufferedReader(new FileReader(FILENAME));
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

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

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() {
            for (long i = 0; i < 3e9; i++)
                ;
        }
    }
}


import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

/*

*/

public class Main{
    static class Node{
        int left;
        int right;
        int index;
        Node(int left,int right,int index){
            this.left=left;
            this.right=right;
            this.index=index;
        }
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        Node[] arr=new Node[n];
        for(int i=0;i<n;i++){
            st=new StringTokenizer(br.readLine());
            arr[i]=new Node(Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()),i);
        }

        Arrays.sort(arr, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                if(o1.left==o2.left){
                    return o1.right-o2.right;
                }else {
                    return o1.left-o2.left;
                }
            }
        });

        int[] suffix=new int[n];
        int[] index=new int[n];
        suffix[n-1]=arr[n-1].right;
        index[n-1]=arr[n-1].index;
        for(int i=n-2;i>=0;i--){
            if(arr[i].right<=suffix[i+1]){
                suffix[i]=arr[i].right;
                index[i]=arr[i].index;
            }else {
                suffix[i]=suffix[i+1];
                index[i]=index[i+1];
            }
        }
        int l=-2,r=-2;
        for(int i=0;i<n;i++){
            if(i<n+1&&arr[i].left==arr[i+1].left){
                l=arr[i].index;
                r=arr[i+1].index;
                break;
            }
        }
        if(l==-2)
        for(int i=1;i<n;i++){
            if(suffix[i]<=arr[i-1].right){
                l=index[i];
                r=arr[i-1].index;
                break;
            }
        }
        l++;
        r++;
        pw.println(l+" "+r);
        pw.close();
    }
}


import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

/*

*/

public class Main{
    static class Node{
        int left;
        int right;
        int index;
        Node(int left,int right,int index){
            this.left=left;
            this.right=right;
            this.index=index;
        }
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        Node[] arr=new Node[n];
        for(int i=0;i<n;i++){
            st=new StringTokenizer(br.readLine());
            arr[i]=new Node(Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()),i);
        }

        Arrays.sort(arr, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                if(o1.left==o2.left){
                    return o1.right-o2.right;
                }else {
                    return o1.left-o2.left;
                }
            }
        });

        int[] suffix=new int[n];
        int[] index=new int[n];
        suffix[n-1]=arr[n-1].right;
        index[n-1]=arr[n-1].index;
        for(int i=n-2;i>=0;i--){
            if(arr[i].right<=suffix[i+1]){
                suffix[i]=arr[i].right;
                index[i]=arr[i].index;
            }else {
                suffix[i]=suffix[i+1];
                index[i]=index[i+1];
            }
        }
        int l=-2,r=-2;
        for(int i=1;i<n;i++){
            if(suffix[i]<=arr[i-1].right){
                l=index[i];
                r=arr[i-1].index;
                break;
            }
        }
        l++;
        r++;
        pw.println(l+" "+r);
        pw.close();
    }
}


import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

/*

*/

public class Main{
    static class Node{
        int left;
        int right;
        int index;
        Node(int left,int right,int index){
            this.left=left;
            this.right=right;
            this.index=index;
        }
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        Node[] arr=new Node[n];
        for(int i=0;i<n;i++){
            st=new StringTokenizer(br.readLine());
            arr[i]=new Node(Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()),i);
        }

        Arrays.sort(arr, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                if(o1.left==o2.left){
                    return o1.right-o2.right;
                }else {
                    return o1.left-o2.left;
                }
            }
        });

        int[] suffix=new int[n];
        int[] index=new int[n];
        suffix[n-1]=arr[n-1].right;
        index[n-1]=arr[n-1].index;
        for(int i=n-2;i>=0;i--){
            if(arr[i].right<=suffix[i+1]){
                suffix[i]=arr[i].right;
                index[i]=arr[i].index;
            }else {
                suffix[i]=suffix[i+1];
                index[i]=index[i+1];
            }
        }
        int l=-2,r=-2;
        for(int i=1;i<n;i++){
            if(suffix[i]<=arr[i-1].right){
                l=arr[i-1].index;
                r=index[i];
                break;
            }
        }
        l++;
        r++;
        pw.println(l+" "+r);
        pw.close();
    }
}


import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

/*

*/

public class Main{
    static class Node{
        int left;
        int right;
        int index;
        Node(int left,int right,int index){
            this.left=left;
            this.right=right;
            this.index=index;
        }
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());
        Node[] arr=new Node[n];
        for(int i=0;i<n;i++){
            st=new StringTokenizer(br.readLine());
            arr[i]=new Node(Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()),i);
        }

        Arrays.sort(arr, new Comparator<Node>() {
            @Override
            public int compare(Node o1, Node o2) {
                if(o1.left==o2.left){
                    return o1.right-o2.right;
                }else {
                    return o1.left-o2.left;
                }
            }
        });

        int[] suffix=new int[n];
        int[] index=new int[n];
        suffix[n-1]=arr[n-1].right;
        index[n-1]=arr[n-1].index;
        for(int i=n-2;i>=0;i--){
            if(arr[i].right<=suffix[i+1]){
                suffix[i]=arr[i].right;
                index[i]=arr[i].index;
            }else {
                suffix[i]=suffix[i+1];
                index[i]=index[i+1];
            }
        }
        int l=-2,r=-2;
        for(int i=0;i<n;i++){
            if(i+1<n&&arr[i].left==arr[i+1].left){
                l=arr[i].index;
                r=arr[i+1].index;
                break;
            }
        }
        if(l==-2)
        for(int i=1;i<n;i++){
            if(suffix[i]<=arr[i-1].right){
                l=index[i];
                r=arr[i-1].index;
                break;
            }
        }
        l++;
        r++;
        pw.println(l+" "+r);
        pw.close();
    }
}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class B {

	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		long R = in.nextLong();
		long C = in.nextLong();
		long k = in.nextLong();

		if(k < R) {
			System.out.println((k+1)+" "+(1));
		}
		else {
			long travUp = (k-R)/(C-1);
			long rem = (k-R)%(C-1);
			if(travUp % 2 == 0) {
				//from left
				System.out.println( (R-travUp)+" "+(2+rem));
			}
			else {
				System.out.println( (R-travUp)+" "+(C-rem));
			}

		}

		out.close();
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class C {

	static range ar[];
	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		int N = in.nextInt();
		ar = new range[N];
		for(int i = 0; i < N; i++) {
			ar[i] = new range(in.nextInt(), in.nextInt(), i+1);
		}

		int ys[] = new int[N];
		for(int i = 0; i < N; i++) ys[i] = ar[i].r;
		RMQ rmq = new RMQ(ys);

		for(int i = 0; i < N-1; i++) {
			int last = bs(0, N-1, ar[i].r);
			if(rmq.query(i+1, last+1) <= ar[i].r) {
				//possible, get answer and return;

				for(int j = i+1; j <= last; j++) {
					if(ar[j].r <= ar[i].r) {
						System.out.println(ar[j].id+" "+ar[i].id);
						return;
					}
				}

			}

		}
		System.out.println("-1 -1");

		out.close();
	}

	static int bs(int lo, int hi, int max) {
		if(lo==hi) return lo;
		if(lo+1 == hi) {
			if(ar[hi].l <= max) return hi;
			return lo;
		}
		int mid = (lo+hi)/2;
		if(ar[mid].l <= max) return bs(mid, hi, max);
		return bs(lo, mid, max);

	}

	static class range implements Comparable<range>{
		int l, r, id;
		public range(int a, int b, int c) {
			l=a;
			r=b;
			id = c;
		}
		@Override
		public int compareTo(range o) {
			if(this.l == o.l) return o.r-this.r;
			return this.l-o.l;
		}
	}

	static class RMQ {
		int[] vs;
		int[][] lift;

		public RMQ(int[] vs) {
			this.vs = vs;
			int n = vs.length;
			int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
			lift = new int[maxlog][n];
			for (int i = 0; i < n; i++)
				lift[0][i] = vs[i];
			int lastRange = 1;
			for (int lg = 1; lg < maxlog; lg++) {
				for (int i = 0; i < n; i++) {
					lift[lg][i] = Math.min(lift[lg - 1][i], lift[lg - 1][Math.min(i + lastRange, n - 1)]);
				}
				lastRange *= 2;
			}
		}

		public int query(int low, int hi) {
			int range = hi - low + 1;
			int exp = Integer.highestOneBit(range);
			int lg = Integer.numberOfTrailingZeros(exp);
			return Math.min(lift[lg][low], lift[lg][hi - exp + 1]);
		}
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class C {

	/*
	 * 6
1 1
2 2
3 3
4 4
114214 125125
19360 19365

6
1 1
2 2
3 3
4 4
114214
125125
19395 19360
	 */

	static range ar[];
	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		int N = in.nextInt();
		ar = new range[N];
		for(int i = 0; i < N; i++) {
			ar[i] = new range(in.nextInt(), in.nextInt(), i+1);
		}
		Arrays.sort(ar);

		int ys[] = new int[N];
		for(int i = 0; i < N; i++) ys[i] = ar[i].r;
		RMQ rmq = new RMQ(ys);

		for(int i = 0; i < N-1; i++) {
			if(ar[i+1].l > ar[i].r) continue;
			int last = bs(i+1, N-1, ar[i].r);
			if(rmq.query(i+1, last) <= ar[i].r) {
				//possible, get answer and return;

				for(int j = i+1; j <= last; j++) {
					if(ar[j].r <= ar[i].r) {
						System.out.println(ar[j].id+" "+ar[i].id);
						return;
					}
				}

			}

		}
		System.out.println("-1 -1");

		out.close();
	}

	static int bs(int lo, int hi, int max) {
		if(lo==hi) return lo;
		if(lo+1 == hi) {
			if(ar[hi].l <= max) return hi;
			return lo;
		}
		int mid = (lo+hi)/2;
		if(ar[mid].l <= max) return bs(mid, hi, max);
		return bs(lo, mid, max);

	}

	static class range implements Comparable<range>{
		int l, r, id;
		public range(int a, int b, int c) {
			l=a;
			r=b;
			id = c;
		}
		@Override
		public int compareTo(range o) {
			if(this.l == o.l) return o.r-this.r;
			return this.l-o.l;
		}
	}

	static class RMQ {
		int[] vs;
		int[][] lift;

		public RMQ(int[] vs) {
			this.vs = vs;
			int n = vs.length;
			int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
			lift = new int[maxlog][n];
			for (int i = 0; i < n; i++)
				lift[0][i] = vs[i];
			int lastRange = 1;
			for (int lg = 1; lg < maxlog; lg++) {
				for (int i = 0; i < n; i++) {
					lift[lg][i] = Math.min(lift[lg - 1][i], lift[lg - 1][Math.min(i + lastRange, n - 1)]);
				}
				lastRange *= 2;
			}
		}

		public int query(int low, int hi) {
			int range = hi - low + 1;
			int exp = Integer.highestOneBit(range);
			int lg = Integer.numberOfTrailingZeros(exp);
			return Math.min(lift[lg][low], lift[lg][hi - exp + 1]);
		}
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class C {

	static range ar[];
	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		int N = in.nextInt();
		ar = new range[N];
		for(int i = 0; i < N; i++) {
			ar[i] = new range(in.nextInt(), in.nextInt(), i+1);
		}

		int ys[] = new int[N];
		for(int i = 0; i < N; i++) ys[i] = ar[i].r;
		RMQ rmq = new RMQ(ys);

		for(int i = 0; i < N-1; i++) {
			if(ar[i+1].l > ar[i].r) continue;
			int last = bs(i+1, N-1, ar[i].r);
			if(rmq.query(i+1, last+1) <= ar[i].r) {
				//possible, get answer and return;

				for(int j = i+1; j <= last; j++) {
					if(ar[j].r <= ar[i].r) {
						System.out.println(ar[j].id+" "+ar[i].id);
						return;
					}
				}

			}

		}
		System.out.println("-1 -1");

		out.close();
	}

	static int bs(int lo, int hi, int max) {
		if(lo==hi) return lo;
		if(lo+1 == hi) {
			if(ar[hi].l <= max) return hi;
			return lo;
		}
		int mid = (lo+hi)/2;
		if(ar[mid].l <= max) return bs(mid, hi, max);
		return bs(lo, mid, max);

	}

	static class range implements Comparable<range>{
		int l, r, id;
		public range(int a, int b, int c) {
			l=a;
			r=b;
			id = c;
		}
		@Override
		public int compareTo(range o) {
			if(this.l == o.l) return o.r-this.r;
			return this.l-o.l;
		}
	}

	static class RMQ {
		int[] vs;
		int[][] lift;

		public RMQ(int[] vs) {
			this.vs = vs;
			int n = vs.length;
			int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
			lift = new int[maxlog][n];
			for (int i = 0; i < n; i++)
				lift[0][i] = vs[i];
			int lastRange = 1;
			for (int lg = 1; lg < maxlog; lg++) {
				for (int i = 0; i < n; i++) {
					lift[lg][i] = Math.min(lift[lg - 1][i], lift[lg - 1][Math.min(i + lastRange, n - 1)]);
				}
				lastRange *= 2;
			}
		}

		public int query(int low, int hi) {
			int range = hi - low + 1;
			int exp = Integer.highestOneBit(range);
			int lg = Integer.numberOfTrailingZeros(exp);
			return Math.min(lift[lg][low], lift[lg][hi - exp + 1]);
		}
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class C {

	static range ar[];
	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		int N = in.nextInt();
		ar = new range[N];
		for(int i = 0; i < N; i++) {
			ar[i] = new range(in.nextInt(), in.nextInt(), i+1);
		}

		int ys[] = new int[N];
		for(int i = 0; i < N; i++) ys[i] = ar[i].r;
		RMQ rmq = new RMQ(ys);

		for(int i = 0; i < N-1; i++) {
			if(ar[i+1].l > ar[i].r) continue;
			int last = bs(i+1, N-1, ar[i].r);
			if(rmq.query(i+1, last) <= ar[i].r) {
				//possible, get answer and return;

				for(int j = i+1; j <= last; j++) {
					if(ar[j].r <= ar[i].r) {
						System.out.println(ar[j].id+" "+ar[i].id);
						return;
					}
				}

			}

		}
		System.out.println("-1 -1");

		out.close();
	}

	static int bs(int lo, int hi, int max) {
		if(lo==hi) return lo;
		if(lo+1 == hi) {
			if(ar[hi].l <= max) return hi;
			return lo;
		}
		int mid = (lo+hi)/2;
		if(ar[mid].l <= max) return bs(mid, hi, max);
		return bs(lo, mid, max);

	}

	static class range implements Comparable<range>{
		int l, r, id;
		public range(int a, int b, int c) {
			l=a;
			r=b;
			id = c;
		}
		@Override
		public int compareTo(range o) {
			if(this.l == o.l) return o.r-this.r;
			return this.l-o.l;
		}
	}

	static class RMQ {
		int[] vs;
		int[][] lift;

		public RMQ(int[] vs) {
			this.vs = vs;
			int n = vs.length;
			int maxlog = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 2;
			lift = new int[maxlog][n];
			for (int i = 0; i < n; i++)
				lift[0][i] = vs[i];
			int lastRange = 1;
			for (int lg = 1; lg < maxlog; lg++) {
				for (int i = 0; i < n; i++) {
					lift[lg][i] = Math.min(lift[lg - 1][i], lift[lg - 1][Math.min(i + lastRange, n - 1)]);
				}
				lastRange *= 2;
			}
		}

		public int query(int low, int hi) {
			int range = hi - low + 1;
			int exp = Integer.highestOneBit(range);
			int lg = Integer.numberOfTrailingZeros(exp);
			return Math.min(lift[lg][low], lift[lg][hi - exp + 1]);
		}
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}


//package math_codet;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    static class Entity{
        int l, r;
        Entity(int ll, int rr){
            l=ll;
            r=rr;
        }
    }
    static final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity a, Entity b){
            int x=Integer.compare(a.l, b.l);
            if(x==0)
                return Integer.compare(b.r, a.r);
            else
                return x;
        }
    };
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int i=0;
        Entity arr[]=new Entity[n];
        for(i=0;i<n;i++){
            arr[i]=new Entity(in.nextInt(),in.nextInt());
        }
        Arrays.sort(arr,com);
        int min=arr[0].l;
        int max=arr[0].r;
        int index=1;
        boolean flag=false;
        for(i=1;i<n;i++){
            if((arr[i].l>=min)&&(arr[i].r<=max)){
                flag=true;
                System.out.println(i+1+" "+index);
                break;
            }
            if((arr[i].l<=min && arr[i].r>=max)||(min==max)){
                index=i+1;
                min=arr[i].l;
                max=arr[i].r;
            }
        }
        if(!flag)
            System.out.println(-1+" "+-1);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


//package math_codet;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    static class Entity{
        int l, r,index;
        Entity(int ll, int rr,int ind){
            l=ll;
            r=rr;
            index=ind;
        }
    }
    static final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity a, Entity b){
            int x=Integer.compare(a.l, b.l);
            if(x==0)
                return Integer.compare(b.r, a.r);
            else
                return x;
        }
    };
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int i=0;
        Entity arr[]=new Entity[n];
        for(i=0;i<n;i++){
            arr[i]=new Entity(in.nextInt(),in.nextInt(),i+1);
        }
        Arrays.sort(arr,com);
        int min=arr[0].l;
        int max=arr[0].r;
        int index=arr[0].index;
        boolean flag=false;
        for(i=1;i<n;i++){
            if((arr[i].l>=min)&&(arr[i].r<=max)){
                flag=true;
                System.out.println(arr[i].index+" "+index);
                break;
            }
            if((arr[i].l<=min && arr[i].r>=max)||(min==max)){
                index=arr[i].index;
                min=arr[i].l;
                max=arr[i].r;
            }
        }
        if(!flag)
            System.out.println(-1+" "+-1);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class Oh_my_god_could_not_solve_such_a_easy_question_shitttt {
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int i=0;
        int arr[][]=new int[n][2];
        for(i=0;i<n;i++){
            arr[i][0]=in.nextInt();
            arr[i][1]=in.nextInt();
        }
        int min=arr[0][0];
        int max=arr[0][1];
        int index=1;
        boolean flag=false;
        for(i=1;i<n;i++){
            if((arr[i][0]>=min)&&(arr[i][1]<=max)){
                flag=true;
                System.out.println(i+1+" "+index);
                break;
            }
            if((arr[i][0]<=min && arr[i][1]>=max)||(min==max)){
                index=i+1;
                min=arr[i][0];
                max=arr[i][1];
            }
        }
        if(!flag)
            System.out.println(-1+" "+-1);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class Oh_my_god_could_not_solve_such_a_easy_question_shitttt {
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int i=0;
        int arr[][]=new int[n][2];
        for(i=0;i<n;i++){
            arr[i][0]=in.nextInt();
            arr[i][1]=in.nextInt();
        }
        int min=arr[0][0];
        int max=arr[0][1];
        int index=1;
        boolean flag=false;
        for(i=1;i<n;i++){
            if((arr[i][0]>=min)&&(arr[i][1]<=max)){
                flag=true;
                System.out.println(i+1+" "+index);
                break;
            }
            if(arr[i][0]<=min && arr[i][1]>=max){
                index=i+1;
                min=arr[i][0];
                max=arr[i][1];
            }
        }
        if(!flag)
            System.out.println(-1+" "+-1);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


//package math_codet;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    static class Entity{
        int l, r,index;
        Entity(int ll, int rr,int ind){
            l=ll;
            r=rr;
            index=ind;
        }
    }
    static final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity a, Entity b){
            int x=Integer.compare(a.l, b.l);
            if(x==0)
                return Integer.compare(b.r, a.r);
            else
                return x;
        }
    };
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        int n=in.nextInt();
        int i=0;
        Entity arr[]=new Entity[n];
        for(i=0;i<n;i++){
            arr[i]=new Entity(in.nextInt(),in.nextInt(),i+1);
        }
        Arrays.sort(arr,com);
        boolean flag=false;
        for(i=1;i<n;i++){
            if((arr[i].l>=arr[i-1].l)&&(arr[i].r<=arr[i-1].r)){
                flag=true;
                System.out.println(arr[i].index+" "+arr[i-1].index);
                break;
            }
        }
        if(!flag)
            System.out.println(-1+" "+-1);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        Section section[] = new Section[n];
        for (int i=0;i<n;i++){
            int l = nextInt();
            int r = nextInt();
            section[i] = new Section(l,r,i+1);
        }

        section = mergeSort(section);//按照l从小到大排序

        int max = section[0].r;//最大的r
        int max_index = 0;//保存最大r的下标
        for (int i=1;i<n;i++){
            if (section[i].r<=max){
                out.println(section[i].index+" "+max_index);
                out.flush();
                return;
            }
            if (section[i].r>max){
                max = section[i].r;
                max_index = section[i].index;
            }
        }
        out.println("-1 -1");
        out.flush();
    }
    public static Section [] mergeSort(Section a[]) {
        return merge(a,0,a.length-1);
    }
    public static Section [] merge(Section a[],int start,int end) {
        int mid = (start+end)/2;
        if(start==end)
            return new Section [] {a[start]};
        else {
            return guibing(merge(a,start,mid),merge(a,mid+1,end));
        }
    }
    public static Section [] guibing(Section a[],Section b[]){
        int n = a.length+b.length;
        Section c[] = new Section[n];
        int i=0;int j=0;int s = 0;
        while(i<a.length&&j<b.length){
            if(a[i].l<b[j].l){
                c[s++]=a[i++];
            }
            if(i<a.length&&a[i].l>b[j].l){
                c[s++]=b[j++];

            }
            if(j<b.length&&i<a.length&&a[i].l==b[j].l) {
                c[s++]=a[i++];
                c[s++]=b[j++];
            }
        }
        while(i<a.length)
            c[s++]=a[i++];
        while(j<b.length)
            c[s++]=b[j++];
        return c;
    }
}
class Section{
    int l;
    int r;
    int index;
    public Section(int l,int r,int index){
        this.l = l;
        this.r = r;
        this.index = index;
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        Section section[] = new Section[n];
        for (int i=0;i<n;i++){
            int l = nextInt();
            int r = nextInt();
            section[i] = new Section(l,r,i+1);
        }

        section = mergeSort(section);//按照l从小到大排序

        int max = section[0].r;//最大的r
        int max_index = section[0].index;//保存最大r的下标
        for (int i=1;i<n;i++){
            if (section[i].r<=max){
                out.println(section[i].index+" "+max_index);
                out.flush();
                return;
            }
            if (section[i].l==section[i+1].l){
                if (section[i].r>section[i+1].r){
                    out.println(section[i+1].index+" "+section[i].index);
                }
                else {
                    out.println(section[i].index+" "+section[i+1].index);
                }
                out.flush();
                return;
            }
            if (section[i].r>max){
                max = section[i].r;
                max_index = section[i].index;
            }
        }
        out.println("-1 -1");
        out.flush();
    }
    public static Section [] mergeSort(Section a[]) {
        return merge(a,0,a.length-1);
    }
    public static Section [] merge(Section a[],int start,int end) {
        int mid = (start+end)/2;
        if(start==end)
            return new Section [] {a[start]};
        else {
            return guibing(merge(a,start,mid),merge(a,mid+1,end));
        }
    }
    public static Section [] guibing(Section a[],Section b[]){
        int n = a.length+b.length;
        Section c[] = new Section[n];
        int i=0;int j=0;int s = 0;
        while(i<a.length&&j<b.length){
            if(a[i].l<b[j].l){
                c[s++]=a[i++];
            }
            if(i<a.length&&a[i].l>b[j].l){
                c[s++]=b[j++];

            }
            if(j<b.length&&i<a.length&&a[i].l==b[j].l) {
                c[s++]=a[i++];
                c[s++]=b[j++];
            }
        }
        while(i<a.length)
            c[s++]=a[i++];
        while(j<b.length)
            c[s++]=b[j++];
        return c;
    }
}
class Section{
    int l;
    int r;
    int index;
    public Section(int l,int r,int index){
        this.l = l;
        this.r = r;
        this.index = index;
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        Section section[] = new Section[n];
        for (int i=0;i<n;i++){
            int l = nextInt();
            int r = nextInt();
            section[i] = new Section(l,r,i+1);
        }

        section = mergeSort(section);//按照l从小到大排序

        int max = section[0].r;//最大的r
        int max_index = section[0].index;//保存最大r的下标
        for (int i=1;i<n;i++){
            if (section[i].r<=max){
                out.println(section[i].index+" "+max_index);
                out.flush();
                return;
            }
            if (section[i-1].l==section[i].l){
                if (section[i-1].r>section[i].r){
                    out.println(section[i].index+" "+section[i-1].index);
                }
                else {
                    out.println(section[i-1].index+" "+section[i].index);
                }
                out.flush();
                return;
            }
            if (section[i].r>max){
                max = section[i].r;
                max_index = section[i].index;
            }
        }
        out.println("-1 -1");
        out.flush();
    }
    public static Section [] mergeSort(Section a[]) {
        return merge(a,0,a.length-1);
    }
    public static Section [] merge(Section a[],int start,int end) {
        int mid = (start+end)/2;
        if(start==end)
            return new Section [] {a[start]};
        else {
            return guibing(merge(a,start,mid),merge(a,mid+1,end));
        }
    }
    public static Section [] guibing(Section a[],Section b[]){
        int n = a.length+b.length;
        Section c[] = new Section[n];
        int i=0;int j=0;int s = 0;
        while(i<a.length&&j<b.length){
            if(a[i].l<b[j].l){
                c[s++]=a[i++];
            }
            if(i<a.length&&a[i].l>b[j].l){
                c[s++]=b[j++];

            }
            if(j<b.length&&i<a.length&&a[i].l==b[j].l) {
                c[s++]=a[i++];
                c[s++]=b[j++];
            }
        }
        while(i<a.length)
            c[s++]=a[i++];
        while(j<b.length)
            c[s++]=b[j++];
        return c;
    }
}
class Section{
    int l;
    int r;
    int index;
    public Section(int l,int r,int index){
        this.l = l;
        this.r = r;
        this.index = index;
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        Section section[] = new Section[n];
        for (int i=0;i<n;i++){
            int l = nextInt();
            int r = nextInt();
            section[i] = new Section(l,r,i+1);
        }

        section = mergeSort(section);//按照l从小到大排序

        int max = section[0].r;//最大的r
        int max_index = section[0].index;//保存最大r的下标
        for (int i=1;i<n;i++){
            if (section[i].r<=max){
                out.println(section[i].index+" "+max_index);
                out.flush();
                return;
            }
            if (section[i].r>max){
                max = section[i].r;
                max_index = section[i].index;
            }
        }
        out.println("-1 -1");
        out.flush();
    }
    public static Section [] mergeSort(Section a[]) {
        return merge(a,0,a.length-1);
    }
    public static Section [] merge(Section a[],int start,int end) {
        int mid = (start+end)/2;
        if(start==end)
            return new Section [] {a[start]};
        else {
            return guibing(merge(a,start,mid),merge(a,mid+1,end));
        }
    }
    public static Section [] guibing(Section a[],Section b[]){
        int n = a.length+b.length;
        Section c[] = new Section[n];
        int i=0;int j=0;int s = 0;
        while(i<a.length&&j<b.length){
            if(a[i].l<b[j].l){
                c[s++]=a[i++];
            }
            if(i<a.length&&a[i].l>b[j].l){
                c[s++]=b[j++];

            }
            if(j<b.length&&i<a.length&&a[i].l==b[j].l) {
                c[s++]=a[i++];
                c[s++]=b[j++];
            }
        }
        while(i<a.length)
            c[s++]=a[i++];
        while(j<b.length)
            c[s++]=b[j++];
        return c;
    }
}
class Section{
    int l;
    int r;
    int index;
    public Section(int l,int r,int index){
        this.l = l;
        this.r = r;
        this.index = index;
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        Section section[] = new Section[n];
        for (int i=0;i<n;i++){
            int l = nextInt();
            int r = nextInt();
            section[i] = new Section(l,r,i+1);
        }

        section = mergeSort(section);//按照l从小到大排序

        int max = 0;//最大的r
        int max_index = 0;//保存最大r的下标
        for (int i=0;i<n;i++){
            if (section[i].r<=max){
                out.println(section[i].index+" "+max_index);
                out.flush();
                return;
            }
            if (section[i].r>max){
                max = section[i].r;
                max_index = section[i].index;
            }
        }
        out.println("-1 -1");
        out.flush();

    }
    public static Section [] mergeSort(Section a[]) {
        return merge(a,0,a.length-1);
    }
    public static Section [] merge(Section a[],int start,int end) {
        int mid = (start+end)/2;
        if(start==end)
            return new Section [] {a[start]};
        else {
            return guibing(merge(a,start,mid),merge(a,mid+1,end));
        }
    }
    public static Section [] guibing(Section a[],Section b[]){
        int n = a.length+b.length;
        Section c[] = new Section[n];
        int i=0;int j=0;int s = 0;
        while(i<a.length&&j<b.length){
            if(a[i].l<b[j].l){
                c[s++]=a[i++];
            }
            if(i<a.length&&a[i].l>b[j].l){
                c[s++]=b[j++];

            }
            if(j<b.length&&i<a.length&&a[i].l==b[j].l) {
                c[s++]=a[i++];
                c[s++]=b[j++];
            }
        }
        while(i<a.length)
            c[s++]=a[i++];
        while(j<b.length)
            c[s++]=b[j++];
        return c;
    }
}
class Section{
    int l;
    int r;
    int index;
    public Section(int l,int r,int index){
        this.l = l;
        this.r = r;
        this.index = index;
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tok;
    static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return false;
            }
        return true;
    }
    static String next()
    {
        hasNext();
        return tok.nextToken();
    }
    static long nextLong()
    {
        return Long.parseLong(next());
    }
    static int nextInt()
    {
        return Integer.parseInt(next());
    }
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {

        int n = nextInt();
        int l[] = new int[n+1];
        int r[] = new int[n+1];
        for (int i=1;i<=n;i++){
            l[i] = nextInt();
            r[i] = nextInt();
        }
        for (int i=1;i<=n-1;i++){
            for (int j=i+1;j<=n;j++){
                if (l[j]>=l[i]&&r[j]<=r[i]){
                    out.println(j+" "+i);
                    out.flush();
                    return;
                }
            }
        }
       out.println("-1 -1");
        out.flush();
    }
}


import java.util.Arrays;
        import java.util.Comparator;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Triple[] a = new Triple[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Triple(in.nextInt(), in.nextInt(),i + 1);
        }
        Arrays.sort(a,new Comp());
        int maxR = Integer.MIN_VALUE;
        int indexOfMaxR = - 1;
        for (int i = 0; i < n; i++){
            if (maxR < a[i].right) {
                maxR = a[i].right;
                indexOfMaxR = a[i].index;
            } else {
                System.out.print(a[i].index  + " " + indexOfMaxR);
                System.exit(0);
            }
        }
        System.out.println("-1 -1");
    }

}

class Triple  {
    int left;
    int right;
    int index;

    Triple(int a, int b, int c){
        left = a;
        right = b;
        index = c;
    }
}

class Comp implements Comparator <Triple> {

    @Override
    public int compare(Triple first, Triple second) {
        if (first.left < second.left) {
            return -1;
        }
        if (first.left > second.left) {
            return 1;
        }

        if (second.right == first.right) {
            return 0;
        }
        if (second.right < first.right) {
            return -1;
        }
        return 1;
    }
}


import java.util.Arrays;
        import java.util.Comparator;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Pair[] a = new Pair[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Pair(in.nextInt(), in.nextInt());
        }
        Arrays.sort(a,new Comp());
        int maxR = Integer.MIN_VALUE;
        int indexOfMaxR = - 1;
        for (int i = 0; i < n; i++){
            if (maxR < a[i].right) {
                maxR = a[i].right;
                indexOfMaxR = i;
            } else {
                System.out.print((i + 1) + " " + (indexOfMaxR + 1));
                System.exit(0);
            }
        }
        System.out.println("-1 -1");
    }

}

class Pair  {
    int left;
    int right;

    Pair(int a, int b){
        left = a;
        right = b;
    }
}

class Comp implements Comparator <Pair> {

    @Override
    public int compare(Pair first, Pair second) {
        if (first.left < second.left) {
            return -1;
        }
        if (first.left > second.left) {
            return 1;
        }

        if (second.right == first.right) {
            return 0;
        }
        if (second.right > first.left) {
            return 1;
        }
        return -1;
    }
}


import java.util.Arrays;
        import java.util.Comparator;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Triple[] a = new Triple[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Triple(in.nextInt(), in.nextInt(),i + 1);
        }
        Arrays.sort(a,new Comp());
        int maxR = Integer.MIN_VALUE;
        int indexOfMaxR = - 1;
        for (int i = 0; i < n; i++){
            if (maxR < a[i].right) {
                maxR = a[i].right;
                indexOfMaxR = a[i].index;
            } else {
                System.out.print(a[i].index  + " " + indexOfMaxR);
                System.exit(0);
            }
        }
        System.out.println("-1 -1");
    }

}

class Triple  {
    int left;
    int right;
    int index;

    Triple(int a, int b, int c){
        left = a;
        right = b;
        index = c;
    }
}

class Comp implements Comparator <Triple> {

    @Override
    public int compare(Triple first, Triple second) {
        if (first.left < second.left) {
            return -1;
        }
        if (first.left > second.left) {
            return 1;
        }

        if (second.right == first.right) {
            return 0;
        }
        if (second.right > first.left) {
            return 1;
        }
        return -1;
    }
}


import java.util.Arrays;
        import java.util.Comparator;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Pair[] a = new Pair[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Pair(in.nextInt(), in.nextInt());
        }
        Arrays.sort(a,new Comp());
        int maxR = Integer.MIN_VALUE;
        int indexOfMaxR = - 1;
        for (int i = 0; i < n; i++){
            if (maxR < a[i].right) {
                maxR = a[i].right;
                indexOfMaxR = i;
            } else {
                System.out.print((indexOfMaxR + 1) + " " + (i + 1));
                System.exit(0);
            }
        }
        System.out.println("-1 -1");
    }

}

class Pair  {
    int left;
    int right;

    Pair(int a, int b){
        left = a;
        right = b;
    }
}

class Comp implements Comparator <Pair> {

    @Override
    public int compare(Pair first, Pair second) {
        if (first.left < second.left) {
            return -1;
        }
        if (first.left > second.left) {
            return 1;
        }

        if (second.right == first.right) {
            return 0;
        }
        if (second.right > first.left) {
            return 1;
        }
        return -1;
    }
}


import java.util.Arrays;
        import java.util.Comparator;
        import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Triple[] a = new Triple[n];
        for (int i = 0; i < n; i++) {
            a[i] = new Triple(in.nextInt(), in.nextInt(),i + 1);
        }
        Arrays.sort(a,new Comp());
        int maxR = Integer.MIN_VALUE;
        int indexOfMaxR = - 1;
        for (int i = 0; i < n; i++){
            if (maxR < a[i].right) {
                maxR = a[i].right;
                indexOfMaxR = a[i].index;
            } else {
                System.out.print(a[i].index  + " " + indexOfMaxR);
                System.exit(0);
            }
        }
        System.out.println("-1 -1");
    }

}

class Triple  {
    int left;
    int right;
    int index;

    Triple(int a, int b, int c){
        left = a;
        right = b;
        index = c;
    }
}

class Comp implements Comparator <Triple> {

    @Override
    public int compare(Triple first, Triple second) {
        if (first.left < second.left) {
            return -1;
        }
        if (first.left > second.left) {
            return 1;
        }

        if (second.right == first.right) {
            return 0;
        }
        if (second.right > first.left) {
            return -1;
        }
        return 1;
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vadim
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ecr43C solver = new ecr43C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ecr43C {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni();
            Seg[] a = new Seg[n];
            for (int i = 0; i < n; i++) {
                a[i] = new Seg(i + 1, in.ni(), in.ni());
            }
            Arrays.sort(a, new Comparator<Seg>() {

                public int compare(Seg o1, Seg o2) {
                    if (o1.r == o2.r) {
                        return -Integer.compare(o1.l, o2.l);
                    } else
                        return Integer.compare(o1.r, o2.r);
                }
            });
            TreeSet<Seg> tree = new TreeSet<>(new Comparator<Seg>() {

                public int compare(Seg o1, Seg o2) {
                    return -Integer.compare(o1.l, o2.l);
                }
            });
            for (Seg seg : a) {
                if (!tree.isEmpty()) {
                    Seg lb = tree.first();
                    if (lb.l >= seg.l) {
                        out.printf("%d %d%n", lb.id, seg.id);
                        return;
                    }
                }
                tree.add(seg);
            }
            out.println("-1 -1");
        }

        class Seg {
            int id;
            int l;
            int r;

            public Seg(int id, int l, int r) {
                this.id = id;
                this.l = l;
                this.r = r;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vadim
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ecr43C solver = new ecr43C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ecr43C {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni();
            Seg[] a = new Seg[n];
            for (int i = 0; i < n; i++) {
                a[i] = new Seg(i + 1, in.ni(), in.ni());
            }
            Arrays.sort(a, Comparator.comparingInt(o -> o.r));
            TreeSet<Seg> tree = new TreeSet<>(new Comparator<Seg>() {

                public int compare(Seg o1, Seg o2) {
                    return Integer.compare(o2.l, o1.l);
                }
            });
            for (Seg seg : a) {
                if (!tree.isEmpty()) {
                    Seg lb = tree.first();
                    if (lb.l >= seg.l) {
                        out.printf("%d %d%n", lb.id, seg.id);
                        return;
                    }
                }
                tree.add(seg);
            }
            out.println("-1 -1");
        }

        class Seg {
            int id;
            int l;
            int r;

            public Seg(int id, int l, int r) {
                this.id = id;
                this.l = l;
                this.r = r;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}