You are playing a board card game. In this game the player has two characteristics, x and y — the white magic skill and the black magic skill, respectively. There are n spell cards lying on the table, each of them has four characteristics, ai, bi, ci and di. In one move a player can pick one of the cards and cast the spell written on it, but only if first two of it's characteristics meet the requirement ai ≤ x and bi ≤ y, i.e. if the player has enough magic skill to cast this spell. However, after casting the spell the characteristics of a player change and become equal to x = ci and y = di.

At the beginning of the game both characteristics of a player are equal to zero. The goal of the game is to cast the n-th spell. Your task is to make it in as few moves as possible. You are allowed to use spell in any order and any number of times (for example, you may not use some spells at all).

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of cards on the table.

Each of the next n lines contains four integers ai, bi, ci, di (0 ≤ ai, bi, ci, di ≤ 109) — the characteristics of the corresponding card.

Output

In the first line print a single integer k — the minimum number of moves needed to cast the n-th spell and in the second line print k numbers — the indices of the cards in the order in which you should cast them. In case there are multiple possible solutions, print any of them.

If it is impossible to cast the n-th spell, print  - 1.

Examples

Input

4
0 0 3 4
2 2 5 3
4 1 1 7
5 3 8 8


Output

3
1 2 4


Input

2
0 0 4 6
5 1 1000000000 1000000000


Output

-1
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

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

    static class TaskF_Quad {
        private static final int INF = Integer.MAX_VALUE / 2;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            List<Integer> allX = new ArrayList<Integer>();

            Card[] cards = new Card[n];
            for (int i = 0; i < n; ++i) {
                cards[i] = new Card(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt(), i);
                allX.add(cards[i].a);
                allX.add(cards[i].c);
            }

            CompressData cdx = new CompressData(allX);

            for (Card card : cards) {
                card.a = cdx.originalToMapping(card.a);
                card.c = cdx.originalToMapping(card.c);
            }

            List<Card>[] cardsOnX = new List[cdx.getSize()];
            int[] ptr = new int[cdx.getSize()];
            for (int i = 0; i < cdx.getSize(); ++i) cardsOnX[i] = new ArrayList<Card>();
            for (Card card : cards) cardsOnX[card.a].add(card);
            SegmentTree tree = new SegmentTree(cdx.getSize() + 5);
            for (int i = 0; i < cdx.getSize(); ++i) {
                Collections.sort(cardsOnX[i]);
                if (!cardsOnX[i].isEmpty()) {
                    tree.set(i, cardsOnX[i].get(0).b, cardsOnX[i].get(0).id);
                }
            }

            List<Point> q = new ArrayList<Point>();
            q.add(new Point(0, 0, -2));


            for (int i = 0; i < q.size(); ++i) {
                Point cur = q.get(i);

                while (true) {
                    int[] min = tree.getMin(0, cur.x + 1);
                    if (min != null) {
                        int id = min[1];
                        if (id == -1) break;
                        if (min[0] > cur.y) break;
                        cards[id].parent = cur.id;
                        q.add(new Point(cards[id].c, cards[id].d, id));
                        ++ptr[cards[id].a];
                        if (ptr[cards[id].a] < cardsOnX[cards[id].a].size()) {
                            Card next = cardsOnX[cards[id].a].get(ptr[cards[id].a]);
                            tree.set(next.a, next.b, next.id);
                        } else {
                            tree.set(cards[id].a, INF, -1);
                        }
                    } else {
                        break;
                    }
                }
            }

            if (cards[n - 1].parent == -1) {
                out.println(-1);
                return;
            }
            List<Integer> path = new ArrayList<Integer>();
            int cur = n - 1;
            while (cur != -2) {
                path.add(cur + 1);
                cur = cards[cur].parent;
            }
            Collections.reverse(path);
            out.println(path.size());
            out.println(ArrayUtils.toString(path));
        }

        class SegmentTree {
            int[] minId;
            int size;
            int[] minValue;

            public SegmentTree(int size) {
                this.size = size;
                minId = new int[size * 4];
                minValue = new int[size * 4];
                Arrays.fill(minValue, INF);
                Arrays.fill(minId, -1);
            }

            int[] getMin(int left, int right) {
                return internalMin(1, 0, size, left, right);
            }

            private int[] internalMin(int v, int rangeLeft, int rangeRight, int left, int right) {
                if (rangeRight <= left || rangeLeft >= right) return new int[]{INF, -1};
                if (rangeLeft >= left && rangeRight <= right) {
                    return new int[]{minValue[v], minId[v]};
                }
                int middle = (rangeLeft + rangeRight) / 2;
                int[] resLeft = internalMin(2 * v, rangeLeft, middle, left, right);
                int[] resRight = internalMin(2 * v + 1, middle, rangeRight, left, right);
                if (resLeft[0] > resRight[0]) {
                    return resRight;
                }
                return resLeft;
            }

            void set(int pos, int value, int id) {
                int v = 1;
                int left = 0, right = size;
                while (left + 1 < right) {
                    int middle = (left + right) / 2;
                    v *= 2;
                    if (pos >= middle) {
                        ++v;
                        left = middle;
                    } else {
                        right = middle;
                    }
                }
                minId[v] = id;
                minValue[v] = value;
                v /= 2;
                while (v > 0) {
                    minValue[v] = minValue[2 * v];
                    minId[v] = minId[2 * v];
                    if (minValue[v] > minValue[2 * v + 1]) {
                        minValue[v] = minValue[2 * v + 1];
                        minId[v] = minId[2 * v + 1];
                    }
                    v /= 2;
                }
            }

        }

        class Point {
            int x;
            int y;
            int id;

            public Point(int x, int y, int id) {
                this.x = x;
                this.y = y;
                this.id = id;
            }

        }

        class Card implements Comparable<Card> {
            int a;
            int b;
            int c;
            int d;
            int id;
            int parent = -1;

            public Card(int a, int b, int c, int d, int id) {
                this.a = a;
                this.b = b;
                this.c = c;
                this.d = d;
                this.id = id;
            }


            public int compareTo(Card o) {
                if (b != o.b) {
                    return b - o.b;
                }
                return id - o.id;
            }

        }

    }

    static class CollectionUtils {
        public static void unique(List<Integer> a) {
            Collections.sort(a);
            int size = 1;
            for (int i = 1; i < a.size(); i++) {
                if (!a.get(i).equals(a.get(size - 1))) {
                    a.set(size++, a.get(i));
                }
            }
            for (int i = a.size() - 1; i >= size; i--) {
                a.remove(i);
            }
        }

    }

    static class ArrayUtils {
        public static String toString(Collection<Integer> collection) {
            StringBuilder result = new StringBuilder("");
            for (int x : collection) {
                result.append(x).append(" ");
            }
            return result.substring(0, result.length() - 1);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String nextString() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

    }

    static class CompressData {
        List<Integer> x;

        public CompressData(List<Integer> x) {
            this.x = x;
            CollectionUtils.unique(this.x);
        }

        public CompressData(int[] x) {
            this.x = new ArrayList<Integer>(x.length);
            for (int i = 0; i < x.length; ++i) {
                this.x.add(x[i]);
            }
            CollectionUtils.unique(this.x);
        }

        public CompressData() {
            this.x = new ArrayList<Integer>();
        }

        public int getSize() {
            return this.x.size();
        }

        public int originalToMapping(int original) {
            return Collections.binarySearch(x, original);
        }

    }
}

