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
#include <bits/stdc++.h>
using namespace std;
const pair<long long int, long long int> INF = {2e9, 2e9};
struct MinTree {
  MinTree(const vector<pair<long long int, long long int>>& init) {
    n = (int)(init).size();
    bound = 1;
    while (bound < n) bound *= 2;
    t = vector<pair<long long int, long long int>>(2 * bound);
    for (int i = (0); i <= (n - 1); ++i) t[bound + i] = init[i];
    for (int i = (n); i <= (bound - 1); ++i) t[bound + i] = INF;
    for (int i = (bound - 1); i >= (0); --i) t[i] = min(t[2 * i], t[2 * i + 1]);
  }
  pair<long long int, long long int> query(int l, int r) {
    l += bound;
    r += bound;
    pair<long long int, long long int> res = INF;
    while (l <= r) {
      if (l % 2 == 1) {
        res = min(res, t[l++]);
      }
      if (r % 2 == 0) {
        res = min(res, t[r--]);
      }
      l /= 2;
      r /= 2;
    }
    return res;
  }
  void replace(int i, pair<long long int, long long int> elm) {
    i += bound;
    t[i] = elm;
    i /= 2;
    while (i > 0) {
      t[i] = min(t[2 * i], t[2 * i + 1]);
      i /= 2;
    }
  }
  vector<pair<long long int, long long int>> t;
  int n, bound;
};
struct Card {
  long long int x1, y1, x2, y2;
};
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<Card> cards;
  map<pair<long long int, long long int>, vector<int>> ind;
  map<pair<long long int, long long int>, int> dist;
  map<pair<long long int, long long int>, int> prv;
  unordered_map<int, int> coord;
  vector<int> cVec;
  for (int i = 0; i < (n); ++i) {
    long long int a, b, c, d;
    cin >> a >> b >> c >> d;
    cards.push_back({a, b, c, d});
    cVec.push_back(a);
    cVec.push_back(c);
  }
  cVec.push_back(0);
  sort((cVec).begin(), (cVec).end());
  cVec.resize(unique((cVec).begin(), (cVec).end()) - cVec.begin());
  for (int i = 0; i < (int)(cVec).size(); i++) {
    coord[cVec[i]] = i;
  }
  const int c = (int)(cVec).size();
  vector<pair<long long int, long long int>> treeInit(c);
  vector<vector<long long int>> vert(c);
  for (int i = 0; i < (n); ++i) {
    auto& card = cards[i];
    card.x1 = coord[card.x1];
    card.x2 = coord[card.x2];
    ind[make_pair(card.y1, card.x1)].push_back(i);
    vert[card.x1].push_back(card.y1);
  }
  for (int i = 0; i < (c); ++i) {
    sort((vert[i]).begin(), (vert[i]).end(), greater<long long int>());
    vert[i].resize(unique((vert[i]).begin(), (vert[i]).end()) -
                   vert[i].begin());
    treeInit[i] = (vert[i].empty() ? INF : make_pair(vert[i].back(), 1LL * i));
  }
  MinTree tree(treeInit);
  queue<pair<long long int, long long int>> q;
  q.push({0, 0});
  if (!vert[0].empty()) {
    vert[0].pop_back();
    tree.replace(0, (vert[0].empty() ? INF : make_pair(vert[0].back(), 0LL)));
  }
  while (!q.empty()) {
    pair<long long int, long long int> p = q.front();
    q.pop();
    for (int x : ind[p]) {
      if (x == n - 1) {
        vector<int> res = {x};
        int it = x;
        while (cards[it].x1 != 0 || cards[it].y1 != 0) {
          it = prv[make_pair(cards[it].y1, cards[it].x1)];
          res.push_back(it);
        }
        assert(dist[p] + 1 == (int)(res).size());
        cout << (dist[p] + 1) << endl;
        for (int i = ((int)(res).size() - 1); i >= (0); --i)
          cout << (res[i] + 1) << ' ';
        cout << endl;
        return 0;
      }
      pair<long long int, long long int> dest =
          make_pair(cards[x].y2, cards[x].x2);
      pair<long long int, long long int> ans;
      while ((ans = tree.query(0, dest.second)).first <= dest.first) {
        dist[ans] = dist[p] + 1;
        prv[ans] = x;
        q.push(ans);
        vert[ans.second].pop_back();
        pair<long long int, long long int> toInsert =
            (vert[ans.second].empty()
                 ? INF
                 : make_pair(vert[ans.second].back(), ans.second));
        tree.replace(ans.second, toInsert);
      }
    }
  }
  cout << "-1\n";
  return 0;
}
